rxn.utilities.csv.column_iterator.iterate_csv_column

rxn.utilities.csv.column_iterator.iterate_csv_column(csv_file, column, delimiter=',')[source]

Iterate through a specific column of a CSV file.

The CSV file is iterated through one line at a time, so that the memory footprint remains very small, even for large files.

Parameters
  • csv_file (Union[str, PathLike]) – CSV file.

  • column (str) – Column to iterate through.

  • delimiter (str, default: ',') – CSV delimiter.

Raises
  • FileNotFoundError – if the file does not exist. Note: the exception is raised not raised if the iterator is not consumed.

  • ValueError – if the column is not valid. Note: the exception is raised not raised if the iterator is not consumed.

Return type

Iterator[str]

Returns

iterator through the values in the selected column.