flat_table
flat_table copied to clipboard
pandas.DataFrame.iteritems depreciated since Pandas version 1.5.0
Hi,
Since updating my pandas to version 2.0 I am getting an error when calling flat_table.normalize.
AttributeError: 'DataFrame' object has no attribute 'iteritems'. Did you mean: 'isetitem'?
After reading the docs I was directed to pandas.DataFrame.items as a viable replacement.
In flat_table\_norm.py I changed line 107 to:
series_list = [('.', n, get_type(s), s) for n, s in df.items()]
and line 141 to:
for _name, _child in temp.items():
And now it is working for me on Python 3.11 w/ Pandas 2.0. I did not try other versions.
Thanks,
Jason
Same problem here. Ugly patch but works:
import pandas as pd
# Monkeypatch Pandas for flat_table._norm.mapper() function using old v1 pd.DataFrame.iteritems instead v2 pd.DataFrame.items
import flat_table; pd.DataFrame.iteritems = pd.DataFrame.items