Error while iterating over dataframe column's entries: "AttributeError: 'Series' object has no attribute 'iteritems'"
Asked Answered
C

1

18

Using pandas version 2, I get an error when calling iteritems.

for event_id, region in column.iteritems():
    pass

The following error message appears:

Traceback (most recent call last):
     File "/home/analyst/anaconda3/envs/outrigger_env/lib/python3.10/site- 
     packages/outrigger/io/gtf.py", line 185, in exon_bedfiles
          for event_id, region in column.iteritems())
AttributeError: 'Series' object has no attribute 'iteritems'
Cycloplegia answered 8/5, 2023 at 12:7 Comment(0)
G
36

iteritems was removed in 2.0.0 by GH45321.

Removed deprecated Series.iteritems()... use obj.items instead. (from v2.0.0 release notes)

You can use items wherever you used iteritems:

for event_id, region in column.items():
    pass
Goeger answered 8/5, 2023 at 15:33 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.