bw2io.extractors.csv#
Classes#
Extracts data from CSV files. |
Module Contents#
- class bw2io.extractors.csv.CSVExtractor[source]#
Bases:
object
Extracts data from CSV files.
See Also:#
ExcelExtractor
: Extracts data from Excel files.
References:#
https://docs.python.org/3/library/csv.html: Official documentation for the csv module in Python.
- 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"]]]