Module: csv#

befordata.csv.read_csv_as_befordata(file_path, sampling_rate, columns=None, sessions=None, time_column=None, meta=None, encoding='utf-8', comment_char='#')#

Read CSV file as befordata

The function can handle comments as well as compressed CSVs, if they end with .csv.xz or .csv.gz

Parameters:
  • file_path (_description_)

  • sampling_rate (_description_)

  • columns (_description_. Defaults to None.)

  • sessions (_description_. Defaults to None.)

  • time_column (_description_. Defaults to None.)

  • meta (_description_. Defaults to None.)

  • encoding (_description_. Defaults to "utf-8".)

  • comment_char (_description_. Defaults to "#".)

Return type:

BeForRecord

befordata.csv.read_csv(file_path, columns=None, encoding='utf-8', comment_char='#')#

Reads CSV file

The function can handle comments as well as compressed CSVs, if they end with .csv.xz or .csv.gz

Parameters:
  • file_path (str | Path) – the path to the CSV file. If file end with .csv.xz or .csv.gz, decompression will be used

  • columns (str | list[str], Optional) – the columns that should be read. If no columns are specified all columns are read

  • encoding (str, optional) – file encoding, default=”utf-8”,

  • comment_char (str, Optional) – line starting with character or string will be treated as comments and returned as a list of strings.

Return type:

pandas.DataFrame and list[str] with all comments