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.DataFrameorIterable[pd.DataFrame]) – Data to export.mask (
pandas.DataFrameorIterable[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 ondata. Dumpdtypesandparse_datesto json information file.parse_dates (
list | bool, default:False) – Information of how to parse dates indata. Dumpdtypesandparse_datesto json information file. For more information seepandas.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 (
strordict, optional) – Name of the output file name(s). List one filename for bothdataandmask({“data”:<filenameD>, “mask”:<filenameM>}). By default, automatically create file name from table name,prefixandsuffix.col_subset (
str,tupleorlist, 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
writeWrite either MDF data or CDM tables to disk.
write_tablesWrite CDM tables to disk.
readRead either original marine-meteorological data or MDF data or CDM tables from disk.
read_dataRead MDF data and validation mask from disk.
read_mdfRead original marine-meteorological data from disk.
read_tablesRead CDM tables from disk.
Note
Use this function after reading MDF data.
- Return type: