cellpy.parameters.legacy.update_headers
#
Module Contents#
Classes#
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
|
Subclass of BaseSetting including option to add postfixes. |
Functions#
|
Create a dictionary that maps old column names to new column names. |
|
Rename the column headers of a cells dataframe. |
|
|
|
|
|
|
|
Rename the summary headers to new format. |
Attributes#
- class HeadersJournalV5[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersJournalV7[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersRawV4[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersRawV5[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersRawV6[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersRawV7[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersStepTableV7[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersSummaryV5[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersSummaryV6[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- class HeadersSummaryV7[source]#
Bases:
cellpy.parameters.internal_settings.BaseHeaders
Subclass of BaseSetting including option to add postfixes.
Example
>>> header["key_postfix"] # returns "value_postfix"
- get_column_name_mapper(old_columns: cellpy.parameters.internal_settings.BaseHeaders, new_columns: cellpy.parameters.internal_settings.BaseHeaders) Tuple[Dict[str, str], List[str], List[str]] [source]#
Create a dictionary that maps old column names to new column names.
- Parameters:
old_columns – The BaseHeaders for the old format.
new_columns – The BaseHeaders for the new format.
- Returns:
Translation dictionary, list of missing keys in new format, list of missing keys in old format.
- rename_columns(df: pandas.DataFrame, old: cellpy.parameters.internal_settings.BaseHeaders, new: cellpy.parameters.internal_settings.BaseHeaders, remove_missing_in_new: bool = False, populate_missing_in_old: bool = True) pandas.DataFrame [source]#
Rename the column headers of a cells dataframe.
- Usage:
>>> old_format_headers = HeadersSummaryV6() >>> new_format_headers = HeadersSummaryV7() >>> df_new_format = rename_columns(df_old_format, old_format_headers, new_format_headers)
- Parameters:
df – The dataframe.
old – The BaseHeaders for the old format.
new – The BaseHeaders for the new format.
remove_missing_in_new – remove the columns that are not defined in the new format.
populate_missing_in_old – add “new-format” missing columns (with np.NAN).
- Returns:
Dataframe with updated columns
- rename_fid_columns(fid_table: pandas.DataFrame, old_version: int, new_version: int = CELLPY_FILE_VERSION, **kwargs) pandas.DataFrame [source]#
- rename_raw_columns(raw: pandas.DataFrame, old_version: int, new_version: int = CELLPY_FILE_VERSION, **kwargs) pandas.DataFrame [source]#
- rename_step_columns(steps: pandas.DataFrame, old_version: int, new_version: int = CELLPY_FILE_VERSION, **kwargs) pandas.DataFrame [source]#
- rename_summary_columns(summary: pandas.DataFrame, old_version: int, new_version: int = CELLPY_FILE_VERSION, **kwargs) pandas.DataFrame [source]#
Rename the summary headers to new format.
- Parameters:
summary – summary dataframe in old format.
old_version – old format (cellpy_file_format (might use summary format number instead soon)).
new_version – new format (cellpy_file_format (might use summary format number instead soon)).
**kwargs – remove_missing_in_new (bool): remove the columns that are not defined in the new format. populate_missing_in_old (bool): add “new-format” missing columns (with np.NAN).
- Returns:
summary (pandas.DataFrame) with column headers in the new format.