Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated iteritems() attribute for Series #93

Open
LuighiV opened this issue Apr 6, 2023 · 1 comment · May be fixed by #92
Open

Deprecated iteritems() attribute for Series #93

LuighiV opened this issue Apr 6, 2023 · 1 comment · May be fixed by #92

Comments

@LuighiV
Copy link

LuighiV commented Apr 6, 2023

Executing with recent version of pandas (2.0.0), released on April 3, 2023, returns this error:

Loaded 1 dataframes
Traceback (most recent call last):
  File "/usr/local/bin/csvs-to-sqlite", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/csvs_to_sqlite/cli.py", line 253, in cli
    to_sql_with_foreign_keys(
  File "/usr/local/lib/python3.9/site-packages/csvs_to_sqlite/utils.py", line 330, in to_sql_with_foreign_keys
    create_sql, columns = get_create_table_sql(
  File "/usr/local/lib/python3.9/site-packages/csvs_to_sqlite/utils.py", line 287, in get_create_table_sql
    columns_and_types = df.dtypes.iteritems()
  File "/usr/local/lib/python3.9/site-packages/pandas/core/generic.py", line 5989, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'iteritems'

This is because a removed method for Series.

Removed deprecated Series.iteritems(), DataFrame.iteritems(), use obj.items instead (GH45321)

Reference: https://pandas.pydata.org/docs/whatsnew/v2.0.0.html#removal-of-prior-version-deprecations-changes

@hcarter333
Copy link

hcarter333 commented Sep 13, 2023

We ran into both of these problems this morning as well. After trying unsuccessfully to change the code, (didn't see this issue till just now), we finally did

pip install pandas==1.5.0

and everything worked like a charm. Would an easier fix be to change the requieqments list for install from pandas>=1.0 to a version that is also <=1.5.0 ?

so...
in setup.py we could have

"pandas>=1.0,<=1.5.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants