cdm_reader_mapper.write_tables#
- cdm_reader_mapper.write_tables(data, data_format='parquet', out_dir=None, prefix=None, suffix=None, extension=None, filename=None, separator='-', cdm_subset=None, col_subset=None, delimiter='|', encoding='utf-8', imodel=None, from_str=None, to_str=None, null_label='null', **kwargs)[source]#
Write pandas.DataFrame to CDM-table file on file system.
- Parameters:
data (
pandas.DataFrame) – pandas.DataFrame to export.data_format (
{"csv", "parquet", "feather"}, default:"parqeut") – Format of input data file(s).out_dir (
str, optional) – Path to the output directory. Default: current directoryprefix (
str, optional) – Prefix of file name structure:<prefix>-<table>-*<suffix>.<extension>.suffix (
str, optional) – Suffix of file name structure:<prefix>-<table>-*<suffix>.<extension>.extension (
str, optional) – Extension of file name structure:<prefix>-<table>-*<suffix>.<extension>.separator (
str, optional) – Separator to join the file name pattern components (default “-“).filename (
strordict, optional) – Name of the output file name(s). List one filename for each table name indata({<table>:<filename>}). Default: Automatically create file name from table name,prefixandsuffix.cdm_subset (
strorlist, optional) – Specifies a subset of tables or a single table.For multiple subsets of tables: This function returns a pandas.DataFrame that is multi-index at the columns, with (table-name, field) as column names. Tables are merged via the report_id field.
For a single table: This function returns a pandas.DataFrame with a simple indexing for the columns.
col_subset (
str,listordict, optional) – Specify the section or sections of the file to write.For multiple sections of the tables: e.g col_subset = {table0:[columns0],…tableN:[columnsN]}
For a single section: e.g. list type object col_subset = [columns] This variable assumes that the column names are all conform to the cdm field names.
delimiter (
str) – Character or regex pattern to treat as the delimiter while reading with df.to_csv. Default: ‘|’encoding (
str) – A string representing the encoding to use in the output file, defaults to utf-8.
See also
writeWrite either MDF data or CDM tables to disk.
write_dataWrite MDF data and validation mask to disk.
readRead either original marine-meteorological data or MDF data or CDM tables from disk.
read_tablesRead CDM tables from disk.
read_dataRead MDF data and validation mask from disk.
read_mdfRead original marine-meteorological data from disk.
Note
Use this function after reading CDM tables.
- Return type: