cdm_reader_mapper.DataBundle#
- class cdm_reader_mapper.DataBundle(*args, **kwargs)[source]#
Class for manipulating the MDF data and mapping it to the CDM.
- Parameters:
data (
pd.DataFrameorIterable[pd.DataFrame], optional) – MDF DataFrame.columns (
pd.Index,pd.MultiIndexorlist, optional) – Column labels ofdatadtypes (
pd.Seriesordict, optional) – Data types ofdata.parse_dates (
listorbool, optional) – Information how to parse dates ondatamask (
pandas.DataFrame, optional) – MDF validation maskimodel (
str, optional) – Name of the MFD/CDM data model.mode (
str) – Data mode (“data” or “tables”) Default: “data”
Examples
Getting a
DataBundlewhile reading data from disk.>>> from cdm_reader_mapper import read_mdf >>> db = read_mdf(source="file_on_disk", imodel="custom_model_name")
Constructing a
DataBundlefrom already read MDf data.>>> from cdm_reader_mapper import DataBundle >>> read = read_mdf(source="file_on_disk", imodel="custom_model_name") >>> data_ = read.data >>> mask_ = read.mask >>> db = DataBundle(data=data_, mask=mask_)
Constructing a
DataBundlefrom already read CDM data.>>> from cdm_reader_mapper import read_tables >>> tables = read_tables("path_to_files").data >>> db = DataBundle(data=tables, mode="tables")
Methods
__init__(*args, **kwargs)add(addition[, inplace])Adding information to a
DataBundle.copy()Make deep copy of a
DataBundle.correct_datetime([imodel, inplace])Correct datetime information in
data.correct_pt([imodel, inplace])Correct platform type information in
data.duplicate_check([inplace])Duplicate check in
data.flag_duplicates([inplace])Flag detected duplicates in
data.get_duplicates(**kwargs)Get duplicate matches in
data.map_model([imodel, inplace])Map
datato the Common Data Model.remove_duplicates([inplace])Remove detected duplicates in
data.replace_columns(df_corr[, subset, inplace])Replace columns in
data.select_where_all_false([inplace, do_mask])Select rows from
datawhere all column entries inmaskare False.select_where_all_true([inplace, do_mask])Select rows from
datawhere all column entries inmaskare True.select_where_entry_isin(selection[, ...])Select rows from
datawhere column entries are in a specific value list.select_where_index_isin(index[, inplace, ...])Select rows from
datawhere indexes within a specific index list.split_by_boolean_false([do_mask])Split
databy rows where all column entries inmaskare False.split_by_boolean_true([do_mask])Split
databy rows where all column entries inmaskare True.split_by_column_entries(selection[, do_mask])Split
databy rows where column entries are in a specific value list.split_by_index(index[, do_mask])Split
databy rows within specific index list.stack_h(other[, datasets, inplace])Stack multiple
DataBundle's horizontally.stack_v(other[, datasets, inplace])Stack multiple
DataBundle's vertically.unique(**kwargs)Get unique values of
data.validate_datetime([imodel])Validate datetime information in
data.validate_id([imodel])Validate station id information in
data.write([dtypes, parse_dates, encoding, mode])Write
dataon disk.Attributes