arundo/adtk

pandas removed deprecated `Series.iteritems()`, `DataFrame.iteritems()`, use `obj.items` instead

Opened this issue · 2 comments

pandas removed deprecated Series.iteritems(), DataFrame.iteritems() but in _data.py you still used iteritems. For example, in line 164 for t, v in time_window_end_series.iteritems(): please change it to items

This is also the reason why the plot function with anomaly_tag="span" (the default value) produces AttributeError: 'Series' object has no attribute 'iteritems'

(because: anomaly=anomalies : pd.Series).

For example, the plot line here would now produce an error: https://adtk.readthedocs.io/en/stable/notebooks/demo.html#PersistAD

s = pd.read_csv('./data/price_short.csv', index_col="Time", parse_dates=True, squeeze=True)
s = validate_series(s)

from adtk.detector import PersistAD
persist_ad = PersistAD(c=3.0, side='positive')
anomalies = persist_ad.fit_detect(s)
plot(s, anomaly=anomalies, ts_linewidth=1, ts_markersize=3, anomaly_color='red');

This is also the reason why the plot function with anomaly_tag="span" (the default value) produces AttributeError: 'Series' object has no attribute 'iteritems'

(because: anomaly=anomalies : pd.Series).

For example, the plot line here would now produce an error: https://adtk.readthedocs.io/en/stable/notebooks/demo.html#PersistAD

How do I fix this issue, the error is indicating in _plot_anomaly function in _visualization.py