Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm's console hangs with "big" objects

I'm using PyCharm, and typically run parts of my scripts in its Python console for debugging purposes. However, when I have to run something on a "big" variable (that consumes a lot of memory), the console becomes very slow.

Say df is a huge pandas data frame, as soon as I type df. in the console, it won't react anymore for 10-15 seconds. I can't tell whether this is pandas specific, since the only "big" variables I use come from pandas.

I'm running the community edition 3.4.1, pandas 0.14, Python 2.7.3, on Mac OS X 10.9.4 (with 8 GB of ram).

Size of df:

In[94]: df.values.nbytes + df.index.nbytes + df.columns.nbytes
Out[94]: 2229198184
like image 756
FooBar Avatar asked Feb 14 '26 08:02

FooBar


1 Answers

I've been having the same problem, and have yet to find a proper solution, but this is a workaround that I've been using, from PyCharm hanging for a long time in iPython console with big data.

Instead of typing df.columns type d.columns and then go back and add the f. This at least prevents the hanging, although it renders the auto-completion a bit useless.

like image 51
mattvivier Avatar answered Feb 16 '26 21:02

mattvivier