foxes.utils.pandas_helpers.PandasFileHelper

class foxes.utils.pandas_helpers.PandasFileHelper[source]

Bases: object

This class helps reading and writing data to files via pandas.

DEFAULT_READING_PARAMETERS

Default parameters for file reading for the supported file formats

Type:

dict

DEFAULT_WRITING_PARAMETERS

Default parameters for file writing for the supported file formats

Type:

dict

DATA_FILE_FORMAT

The supported file formats for data export

Type:

list:str

DEFAULT_FORMAT_DICT

Default column formatting

Type:

dict

__init__()

Methods

__init__()

read_file(file_path, **kwargs)

Helper for reading data according to file ending.

write_file(data, file_path[, format_dict])

Helper for writing data according to file ending.

Attributes

DATA_FILE_FORMATS

DEFAULT_FORMAT_DICT

DEFAULT_READING_PARAMETERS

DEFAULT_WRITING_PARAMETERS

classmethod read_file(file_path, **kwargs)[source]

Helper for reading data according to file ending.

Parameters:
  • file_path (str) – The path to the file

  • **kwargs (dict, optional) – Parameters forwarded to the pandas reading method.

Returns:

The data

Return type:

pandas.DataFrame

classmethod write_file(data, file_path, format_dict={}, **kwargs)[source]

Helper for writing data according to file ending.

Parameters:
  • data (pandas.DataFrame) – The data

  • file_path (str) – The path to the file

  • format_dict (dict) – Dictionary with format entries for columns, e.g. ‘{:.4f}’

  • **kwargs (dict, optional) – Parameters forwarded to the pandas writing method.