bw2io.extractors.csv#

Module Contents#

Classes#

CSVExtractor

Extract data from CSV files.

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

Bases: object

Extract data from CSV files.

classmethod extract(filepath, encoding='utf-8-sig')[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

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

rtype

list

raises AssertionError

If the file does not exist.

Examples

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