Why pandas deprecation of iteritems() is influencing the pd.DataFrame().columns?
Question:
I have a code that is using pandas everywhere. In various instances, wheather I am using Series or just calling .columns method, I receive this warning:
C:Program FilesJetBrainsPyCharm Community Edition 2021.2.3pluginspython-cehelperspydev_pydevd_bundlepydevd_utils.py:609: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
for item in s.iteritems():
I am not using iteritems() directly. Why do I have this warning message?
Should I worry about it? Will my code be compatible with future versions?
Answers:
This is the future warning, and as suggested, use s.items()
instead of s.iteritems()
You may not use the iteritems() directly, but your code refers to a library which does, in pydevd_utils.py
If it works, there is nothing to worry about for the current version, but of course this won’t be future proof and will fail e.g. if you install pandas 2.0.0.
I have a code that is using pandas everywhere. In various instances, wheather I am using Series or just calling .columns method, I receive this warning:
C:Program FilesJetBrainsPyCharm Community Edition 2021.2.3pluginspython-cehelperspydev_pydevd_bundlepydevd_utils.py:609: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
for item in s.iteritems():
I am not using iteritems() directly. Why do I have this warning message?
Should I worry about it? Will my code be compatible with future versions?
This is the future warning, and as suggested, use s.items()
instead of s.iteritems()
You may not use the iteritems() directly, but your code refers to a library which does, in pydevd_utils.py
If it works, there is nothing to worry about for the current version, but of course this won’t be future proof and will fail e.g. if you install pandas 2.0.0.