IndEcol / pymrio

Multi-Regional Input-Output Analysis in Python.
http://pymrio.readthedocs.io/en/latest/
Other
154 stars 71 forks source link

Address FutureWarning from pandas in parser. #93

Closed spjuhel closed 1 year ago

spjuhel commented 1 year ago

Recent versions of pandas give the following warning when parsing OECD-ICIO:

FutureWarning: Using the level keyword in DataFrame and Series aggregations is deprecated and will be removed in a future version. Use groupby instead. df.sum(level=1) should use df.groupby(level=1).sum().

Suggestion: Follow pandas' recommendation.

Example: Replace

https://github.com/konstantinstadler/pymrio/blob/57a8d4152b10929a7f0d2946b0e797c3e846c850/pymrio/tools/ioparser.py#L1665

By

Z.loc[co_name, :] + Z.loc[agg_list, :].groupby(level="sector",axis=0).sum()