PyCharm hanging for a long time in iPython console with big data

前端 未结 5 1558
难免孤独
难免孤独 2021-02-03 20:26

I\'ve seen some reports PyCharm is slow but I\'m having an issue that seems that\'s too slow even compared to normal operation.

I have a big set of data in a pandas data

相关标签:
5条回答
  • 2021-02-03 21:07

    Depending on how much you handle the data could hit memory limits. Ipython remembers each In []: and Out []:.

    In is a list that is appended to for each think you input. Out is another list that gets appended to.

    So if you have a very large array you are working with in In or Out You will get several copies of the array.

    0 讨论(0)
  • 2021-02-03 21:08

    If you have not solved this issue yet:

    I am using pycharm 2020.2 on macos. I read in a not-too-large csv file as pandas.DataFrame format with 239150 rows x 95 columns. When I typed df.columns in the interactive Debug console, similarly, the console hung for about 3 minutes to show the columns. We might have to wait for a real solution from pycharm update.

    For now, a quick dirty solution is:

    1. To write df.columns in your .py file, and,

    2. Select the command > right click > "Execute Selection in Python Console".

    0 讨论(0)
  • 2021-02-03 21:25

    Disabling "show variables" alleviated the slowness I was experiencing. To do this, go to

    Pycharm > Preferences > Build, Execution, Deployment > Console and uncheck Show console variables by default.

    Then restart your session.

    0 讨论(0)
  • 2021-02-03 21:29

    I have been facing the same issue for a long time as well: PyCharm debugging is extremely slow when using large pandas dataframes. If I want to view the contents of a dataframe in the Watches is often gives me a time out after waiting for minutes, so I basically stopped using the debug when working with dataframes

    What I just found however, it that under

    Files -> Settinggs -> Build, Execution, Deployment -> Python Debugger

    You have to switch on the "Gevent Compatible" flag

    I also have switched on all the other flags in this window (Collect rum-time types information, attach subprocess, and PyQt compatible). But the Gevent compatible flag really does the job for me: it suddenly instantanuously gives me the dataframe contents in the debugger watches.

    I am using PyCharm verion 2016.2.3

    0 讨论(0)
  • 2021-02-03 21:32

    If you don't mind disabling the autocompletion completely, I think this should work:

    Go to File > Settings (Ctrl+Alt+S) > IDE Settings > Editor > Code Completion

    And turn off Insert selected variant by typing dot, space, etc.

    0 讨论(0)
提交回复
热议问题