df_util¶
Functions
|
Convert all tags in underlying dataframe to the specified form (in place). |
|
Expands any def tags found in the dataframe. |
|
Load a tabular file and its associated HED sidecar file. |
|
Gather def-expand tags in the strings/compare with known definitions to find any differences |
|
Shrink (in place) any def-expand tags found in the specified columns in the dataframe. |
- convert_to_form(df, hed_schema, tag_form, columns=None)[source]¶
Convert all tags in underlying dataframe to the specified form (in place).
- Parameters:
df (pd.Dataframe or pd.Series) – The dataframe or series to modify
hed_schema (HedSchema) – The schema to use to convert tags.
tag_form (str) – HedTag property to convert tags to.
columns (list) – The columns to modify on the dataframe.
- expand_defs(df, hed_schema, def_dict, columns=None)[source]¶
Expands any def tags found in the dataframe.
Converts in place
- Parameters:
df (pd.Dataframe or pd.Series) – The dataframe or series to modify
hed_schema (HedSchema or None) – The schema to use to identify defs
def_dict (DefinitionDict) – The definitions to expand
columns (list or None) – The columns to modify on the dataframe
- get_assembled(tabular_file, sidecar, hed_schema, extra_def_dicts=None, join_columns=True, shrink_defs=False, expand_defs=True)[source]¶
Load a tabular file and its associated HED sidecar file.
- Parameters:
tabular_file – str or TabularInput The path to the tabular file, or a TabularInput object representing it.
sidecar – str or Sidecar The path to the sidecar file, or a Sidecar object representing it.
hed_schema – HedSchema If str, will attempt to load as a version if it doesn’t have a valid extension.
extra_def_dicts – list of DefinitionDict, optional Any extra DefinitionDict objects to use when parsing the HED tags.
join_columns – bool If true, join all HED columns into one.
shrink_defs – bool Shrink any def-expand tags found
expand_defs – bool Expand any def tags found
- Returns:
hed_strings(list of HedStrings):A list of HedStrings or a list of lists of HedStrings def_dict(DefinitionDict): The definitions from this Sidecar
- Return type:
tuple
- process_def_expands(hed_strings, hed_schema, known_defs=None, ambiguous_defs=None)[source]¶
Gather def-expand tags in the strings/compare with known definitions to find any differences
- Parameters:
hed_strings (list or pd.Series) – A list of HED strings to process.
hed_schema (HedSchema) – The schema to use
known_defs (DefinitionDict or list or str or None) – A DefinitionDict or anything its constructor takes. These are the known definitions going in, that must match perfectly.
ambiguous_defs (dict) – A dictionary containing ambiguous definitions format TBD. Currently def name key: list of lists of HED tags values
- Returns:
A tuple containing the DefinitionDict, ambiguous definitions, and errors.
- Return type:
tuple
- shrink_defs(df, hed_schema, columns=None)[source]¶
Shrink (in place) any def-expand tags found in the specified columns in the dataframe.
- Parameters:
df (pd.Dataframe or pd.Series) – The dataframe or series to modify
hed_schema (HedSchema or None) – The schema to use to identify defs.
columns (list or None) – The columns to modify on the dataframe.