nipoppy.tabular.base.BaseTabular¶
- class nipoppy.tabular.base.BaseTabular(*args, **kwargs)¶
Generic class with utilities for tabular data.
See https://pandas.pydata.org/docs/development/extending.html.
- add_or_update_records(records, validate=True)¶
Add or update records.
- concatenate(other, validate=True)¶
Concatenate two dataframes.
- Parameters:
other (typing_extensions.Self)
- Return type:
typing_extensions.Self
- find_duplicates(cols=None)¶
Find duplicate records.
- Return type:
typing_extensions.Self
- get_diff(other, cols=None)¶
Get the difference between two dataframes (self - other).
Returns a slice of self. If cols is None, the index_cols of the first object is used.
- Parameters:
other (typing_extensions.Self)
- Return type:
typing_extensions.Self
- get_series_class()¶
Get the series class associated with a dataframe.
- Return type:
- classmethod load(fpath, validate=True, **kwargs)¶
Load (and optionally validate) a tabular data file.
- Parameters:
fpath (nipoppy.env.StrOrPathLike)
- Return type:
typing_extensions.Self
- save_with_backup(fpath_symlink, dname_backups=None, use_relative_path=True, sort=True, dry_run=False)¶
Save the dataframe to a file with a backup.
- Parameters:
fpath_symlink (nipoppy.env.StrOrPathLike)
dname_backups (Optional[str])
- Return type:
pathlib.Path | None
- sort_values(**kwargs)¶
Sort the dataframe, by default on specific columns and ignoring the index.
- validate()¶
Validate the dataframe based on the model.
- Return type:
typing_extensions.Self
- property model: type[BaseTabularModel]¶
- Abstractmethod:
- Return type:
Model class associated with the tabular data.
- sep = '\t'¶