PyDev FutureWarning Django console

已回答

When using Pandas in the Django/Python Console I get the following error:

/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NAMES has been deprecated.
obj = getattr(obj_to_complete, d)
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NUMBERS has been deprecated.
obj = getattr(obj_to_complete, d)

This happens on nearly any action that accesses a DataFrame through an index or attribute. Such as:

 df.columns

When I read in a csv, that is approximately 30k rows, this issue is consistently reproducible. There is some variability on how often it happens after the first warning, and the amount of time it takes to return results from actions on the DataFrame. First time calling a method will take in excess of 3 seconds, but subsequent calls of similar operations may be near normal or sometimes longer, with/without the warning.

Any input on what to do to resolve or avoid this issue would be wonderful. This seems to only happen in my Django projects. 

Environment:

PyCharm 2020.2 (Professional Edition)
Build #PY-202.6397.98, built on July 27, 2020
Runtime version: 11.0.7+10-b944.20 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Non-Bundled Plugins: IdeaVIM, net.seesharpsoft.intellij.plugins.csv, com.jetbrains.intellij.datalore, R4Intellij

MacBook Pro 2019, 2.6GHz i7, 16GB 2400MHz DDR4

Python: 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)

Django: 3.0.9 and 3.1

pandas: 1.10

No additional packages outside of the defaults for a Django project installed.

6
Avatar
Permanently deleted user

Same issue. Really annoying, literally floods the console with these warnings when I want to concentrate on what's going on with dataframes.

4

Hi,

I can't reproduce it in my environment.

Does it happen in a brand new project?

Would it be possible to provide a project along with steps for reproducing the problem?

1
Avatar
Permanently deleted user

Hi Sergey,

It does happen in a brand new Django project, and has cropped up in my other only barely older Django projects.

How would you like me to provide a project? I could create a github repo, but it honestly might be overkill as just creating a new Django project and installing pandas seems to reproduce it. (using the pathway: File > New Project > [select Django in left side panel of new window] > create)

[old text edited out - incorrectly stated it seemed to be Mac only]

EDIT! It appears on my Windows computer as well. I was running an older version of PyCharm on my Windows computer and the warning did not occur. With version 2020.2 the warning occurs.

Prior version on Windows with no warnings:

PyCharm 2020.1.4 (Professional Edition)
Build #PY-201.8743.11, built on July 21, 2020

Updated to the following and warning starts to occur:

PyCharm 2020.2 (Professional Edition)
Build #PY-202.6397.98, built on July 27, 2020

More details on environment:

Using venv

pip freeze output:

asgiref==3.2.10
Django==3.1
numpy==1.19.1
pandas==1.1.0
python-dateutil==2.8.1
pytz==2020.1
six==1.15.0
sqlparse==0.3.1

 

Another interesting thing I just noticed is that the warning and delay sometimes only crops up on the first time running a command on a singular file. As in, repeating steps on the same file did not reproduce the warning, even when I stoped or restarted the Console. Example:

>>> import pandas as pd
>>> df = pd.read_csv('/Users/user_name/PycharmProjects/SYNC/example_data/example_30k.csv')
>>> df.columns
# Warning occurs in the console along with delay
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NAMES has been deprecated.
obj = getattr(obj_to_complete, d)
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NUMBERS has been deprecated.
obj = getattr(obj_to_complete, d)
## output of columns omitted

>>> df.columns
# No warning occurs

>>> df.iloc[10]
# Warning occurs in the console along with delay
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NAMES has been deprecated.
obj = getattr(obj_to_complete, d)
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NUMBERS has been deprecated.
obj = getattr(obj_to_complete, d)

##### Restart console and/or start and reopen console
>>> import pandas as pd
>>> df = pd.read_csv('/Users/user_name/PycharmProjects/SYNC/example_data/example_30k.csv')
>>> df.columns
# No warning occurs,
# But!! there is often a substantial delay in the return on the results.
# This delay seems to increase in the amount of time between repeats on this action or actions between this action
# As in, waiting 30+ seconds and repeating df.columns or df.iloc[10] will have a long delay again

##### Restart console and try a new file - warning occurs again
>>> import pandas as pd
>>> df = pd.read_csv('/Users/user_name/PycharmProjects/SYNC/example_data/a_different_example_data_set.csv')
>>> df.columns
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NAMES has been deprecated.
obj = getattr(obj_to_complete, d)
/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py:213: FutureWarning: _AXIS_NUMBERS has been deprecated.
obj = getattr(obj_to_complete, d)

>>> df.iloc[10]
# Only sometimes produces the warning...

 

Hope this helps. I'll play around with it a bit more and report any more pertinent details if I come across them.

 

Edit:

The warnings pop up often and every time I do something like df.columns in my larger projects. Brand new projects it's a lot more variable on when it happens on repeated operations, but on established/larger projects it appears to happen much more often.

0

Got it, thanks!

It's reproducible with pandas==1.1.0. I filed a bug to our issue tracker https://youtrack.jetbrains.com/issue/PY-43972, please feel free to vote and comment.

4
Avatar
Permanently deleted user

This error is also reproducible with pandas==1.1.1 

0
Avatar
Permanently deleted user

Hi, has it been resolved?

0

According to https://youtrack.jetbrains.com/issue/PY-43972, it's been resolved in 2020.2.2

Let me know if the issue is still reproduced in the latest version.

0
Avatar
Permanently deleted user

Hi, thanks for the response, I confirm it works great now (2020.3)

0

请先登录再写评论。