romcomma.data.storage.Frame§

class Frame(csv=WindowsPath('.'), df=Empty DataFrame Columns: [] Index: [], **kwargs)[source]§

Bases: object

Encapsulates a pd.DataFrame (df) backed by a source file.

Parameters:
  • csv (Path | str) –

  • df (pd.DataFrame) –

__init__(csv=WindowsPath('.'), df=Empty DataFrame Columns: [] Index: [], **kwargs)[source]§

Initialize Frame.

Parameters:
  • csv (Path | str) – The csv file.

  • df (DataFrame) – The initial data. If this is empty, it is read from csv, otherwise it overwrites (or creates) csv.

Keyword Arguments:

kwargs – Updates Frame.CSV_OPTIONS for csv reading as detailed in https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html. This is not relevant to writing, which just uses Frame.CSV_OPTIONS.

Methods

__init__([csv, df])

Initialize Frame.

write()

Write to csv, according to Frame.CSV_OPTIONS.

Attributes

CSV_OPTIONS

csv

is_empty

Defines the empty Frame as that having an empty Path.

class property CSV_OPTIONS: Dict[str, Any]§

The default options (kwargs) to pass to pandas.pd.read_csv.

property is_empty: bool§

Defines the empty Frame as that having an empty Path.

write()[source]§

Write to csv, according to Frame.CSV_OPTIONS.