fileflow.utils package

fileflow.utils.dataframe_utils module

fileflow.utils.dataframe_utils.clean_and_write_dataframe_to_csv(data, filename)[source]

Cleans a dataframe of np.NaNs and saves to file via pandas.to_csv

Parameters:
  • data (pandas.DataFrame) – data to write to CSV
  • filename (str | None) – Path to file to write CSV to. if None, string of data will be returned
Returns:

If the filename is None, returns the string of data. Otherwise returns None.

Return type:

str | None

fileflow.utils.dataframe_utils.read_and_clean_csv_to_dataframe(filename_or_stream, encoding='utf-8')[source]

Reads a utf-8 encoded CSV directly into a pandas dataframe as string values and scrubs np.NaN values to Python None

Parameters:filename_or_stream (str) – path to CSV
Returns: