cdm_reader_mapper.write_data

Contents

cdm_reader_mapper.write_data#

cdm_reader_mapper.write_data(data, mask=None, data_format='parquet', dtypes=None, parse_dates=False, encoding='utf-8', out_dir='.', prefix=None, suffix=None, extension=None, filename=None, separator='_', col_subset=None, delimiter=',', **kwargs)[source]#

Write pandas.DataFrame to MDF file on file system.

Parameters:
  • data (pandas.DataFrame or Iterable[pd.DataFrame]) – Data to export.

  • mask (pandas.DataFrame or Iterable[pd.DataFrame], optional) – Validation mask to export.

  • data_format ({"csv", "parquet", "feather"}, default: "parquet") – Format of output data file(s).

  • dtypes (dict, optional) – Dictionary of data types on data. Dump dtypes and parse_dates to json information file.

  • parse_dates (list | bool, default: False) – Information of how to parse dates in data. Dump dtypes and parse_dates to json information file. For more information see pandas.read_csv().

  • encoding (str, default: "utf-8") – A string representing the encoding to use in the output file, defaults to utf-8.

  • out_dir (str, default: ".") – Path to the output directory.

  • prefix (str, optional) – Prefix of file name structure: <prefix>-data-*<suffix>.<extension>.

  • suffix (str, optional) – Suffix of file name structure: <prefix>-data-*<suffix>.<extension>.

  • extension (str, optional) – Extension of file name structure: <prefix>-data-*<suffix>.<extension>. By default, extension depends on data_format.

  • separator (str, optional) – Separator to join the file name pattern components (default “_”).

  • filename (str or dict, optional) – Name of the output file name(s). List one filename for both data and mask ({“data”:<filenameD>, “mask”:<filenameM>}). By default, automatically create file name from table name, prefix and suffix.

  • col_subset (str, tuple or list, optional) – Specify the section or sections of the file to write.

    • For multiple sections of the tables: e.g col_subset = [columns0,…,columnsN]

    • For a single section: e.g. list type object col_subset = [columns]

    Column labels could be both string or tuple.

  • delimiter (str, default: ",") – Character or regex pattern to treat as the delimiter while reading with df.to_csv.

See also

write

Write either MDF data or CDM tables to disk.

write_tables

Write CDM tables to disk.

read

Read either original marine-meteorological data or MDF data or CDM tables from disk.

read_data

Read MDF data and validation mask from disk.

read_mdf

Read original marine-meteorological data from disk.

read_tables

Read CDM tables from disk.

Note

Use this function after reading MDF data.

Return type:

None