REGISTER NOW: DdS Autumn School! 🇨🇭 Grosshöchstetten (Switzerland) 🗓️ 6.-11. October 2024

bw2io.extractors.csv#

Module Contents#

Classes#

CSVExtractor

Extracts data from CSV files.

class bw2io.extractors.csv.CSVExtractor[source]#

Bases: object

Extracts data from CSV files.

See Also:#

References:#

classmethod extract(filepath, encoding='utf-8-sig', **kwargs)[source]#

Extracts CSV file data from the filepath.

Parameters:#
filepathstr

The path to the CSV file.

encodingstr, optional

The encoding of the CSV file, with default being “utf-8-sig”.

Returns:#
list

A list containing the filename and the contents of the CSV file.

Raises:#
AssertionError

If the file does not exist.

Examples:#
>>> CSVExtractor.extract("example.csv")
["example.csv", [["1", "2", "3"], ["4", "5", "6"]]]