rcx_tk.io

Functions

read_file(→ pandas.DataFrame)

Imports the metadata file to pandas dataframe.

save_dataframe_as_tsv(→ None)

Saves the dataframe as a TSV file.

Module Contents

rcx_tk.io.read_file(file_path: str, **kwargs) pandas.DataFrame[source]

Imports the metadata file to pandas dataframe.

Parameters:
  • file_path (str) – The path to the input data.

  • kwargs – Variable keyword arguments to pass to the pd.read_ style functions

Raises:

ValueError – Error if any file format except for csv, xls, xlsx, txt or tsv is provided.

Returns:

Dataframe containing the metadata.

Return type:

pd.DataFrame

rcx_tk.io.save_dataframe_as_tsv(df: pandas.DataFrame, file_path: str, header: bool = True, index: bool = False, mode: str = 'w') None[source]

Saves the dataframe as a TSV file.

Parameters:
  • df (pd.DataFrame) – The metadata dataframe.

  • file_path (str) – A path where the .TSV will be exported, containing the <fileName>.TSV.

  • header (bool) – Whether to write the header or not.

  • index (bool) – Whether to write the index or not.

  • mode (str) – Mode in which to open the file - one of w or a.

Raises:

ValueError – Error if provided <fileName> is of a different format than TSV.