MaximeAgez / pylcaio

A Python class to hybridize lifecycle assessment (LCA) and environmentally extended input-output (EEIO) databases.
GNU General Public License v2.0
38 stars 7 forks source link

bug in cleaning sector names of IO #4

Closed jakobsarthur closed 2 years ago

jakobsarthur commented 2 years ago

The following line is causing inconsistencies between the sector names from the concordance excel file (productTaypeName) and the filtered sector_of_IO list. this is because there are sector names that have brackets with numbers and brakcets without. The split function cuases the issue. E.g:

"Wood and products of wood and cork (except furniture); articles of straw and plaiting materials (20)" becomes: "Wood and products of wood and cork"

can be fixed by replacing the following line:

cleaning up exiobase sector names

[i.split(' (')[0] if re.findall(r'\d', i) else i for i in self.sectors_of_IO]

with:

cleaning up exiobase sector names

self.sectors_of_IO = [re.sub(r' (\d\d)', '', i) for i in self.sectors_of_IO]

MaximeAgez commented 2 years ago

Thanks for spotting the error @jakobsarthur.

Fixed in commit 63423d57926910c264c9c897f1d4f4c3a6495f0a