metasyn.read_csv

metasyn.read_csv(fp, separator=None, eol_char='\\n', quote_char='"', null_values=None, **kwargs)

Create the file interface from a file.

This function is a wrapper around polars.read_csv <https://docs.pola.rs/api/python/dev/reference/api/polars.read_csv.html> with different defaults for some of the keywords, but all keywords should be passed through.

Parameters:
  • fp (Union[Path, str]) – File to be read.

  • separator (Optional[str]) – Separator for the csv file, by default None in which case the separator will be a “,” for .csv files and a “\t” for .tsv files.

  • eol_char (str) – End of line character, by default “\n”

  • quote_char (str) – Quotation character, by default ‘”’

  • null_values (Union[str, list[str], None]) – Values that will be replaced by nulls, by default None in which case the defaults of polars will be used [“”, “na”, “NA”, “N/A”, “Na”].

  • kwargs – Extra keyword arguments to be passed through to polars.

Return type:

tuple[DataFrame, CsvFileInterface]

Returns:

  • df – Data frame read from the files.

  • cls – CsvFileInterface instance containing information on how to write CSV files.