Is there a Variable Explorer for PyCharm

122,291

Solution 1

The variable list is available in the python console Tools --> Run Python Console... as shown in the screen shot below. Similar functionality for showing variables and watched variables is available in the debugger console.

enter image description here

Solution 2

I like Spyder for interacting with my variables and PyCharm for editing my scripts. Alternative Solution: use both simultaneously. As I edit in PyCharm (on Mac OS), the script updates live in spyder. Best of both worlds!

Solution 3

For your second question: you can also select your code and press shift + alt + E to run a part of your script on to the python console

Solution 4

If you want to inspect variables that contain arrays or datasets, like Spyder and see them as a nice table, you can do bellow :

1- Put a breakpoint after the variable that you like to inspect ( in my case, it's dataset) : enter image description here

2- Run the debugger ( the little bug on the top-right side of pyCharm).

The debugger will then stop on the line and you'll see something like below in your debugger window at the bottom of the pyCharm. enter image description here

3- Right click on the variable and select View As DataFrame

enter image description here

4- You then will be presented by a nice table like below :

enter image description here

Solution 5

PyCharm has SciView for exploring variables in almost exactly the same manner as Spyder. Simply execute the selection or cell in console, then click View as Array in the Special Variable pane. Special Variable Pane

Share:
122,291
Admin
Author by

Admin

Updated on July 12, 2020

Comments

  • Admin
    Admin almost 4 years

    I recently changed from Spyder to PyCharm as a Python IDE. In Spyder I have often used the variable explorer feature (see picture). Is this feature also available in PyCharm?enter image description here

    I found this here, that "Variable explorer in Python console (traff)" should be included in PyCharm 3, but I cannot find that. Maybe someone could tell me how to use that tool.

  • Admin
    Admin about 10 years
    Great, is it possible to run an entire script in the python console? Or do I have to run line by line? Also, how would I access the debugger console?
  • andrewmo
    andrewmo about 10 years
    You can paste chunks of code into the console and it will execute. See this answer for how to set up debugging. stackoverflow.com/a/10240047/3435646
  • andrewmo
    andrewmo about 10 years
    Even better than pasting code into the console, just select the code in the editor, right click and choose Execute Line in Console... Then open up the debugger console and see the results. You can also execute chunks of code in the Evaluate Expression... dialog. (One thing I discovered about this is that Print statements show up in the console, not in the expression dialog)
  • Rutger Hofste
    Rutger Hofste about 8 years
    Just switched from Spyder to pycharm as well. I can't find my assigned parameters in this huge list of variables. Is there a way to filter this? Or where can I find if I assign foo = 2 + 2 for example?
  • lppier
    lppier almost 8 years
    I think the Spyder does a better job at being "Matlab" than PyCharm. The variable explorer in Spyder looks more useful, like how one would use it in Matlab.
  • Bagusflyer
    Bagusflyer almost 6 years
    @lppier Agree. Although PyCharm looks better.
  • lppier
    lppier almost 6 years
    @ZhouHao there is a new kid on the block, check out JupyterLab, I've been using it. I like how it is light on loading tables.
  • Mike_K
    Mike_K over 5 years
    Since my Spyder permanently broke, I found this as a good enough work around. Thanks! shift + alt + E to excecute code makes PyCharm enough like Spyder for me.
  • Srinath Ganesh
    Srinath Ganesh about 5 years
    moving towards this! pycharm is more easy to code while spyder is better to understand data
  • Mudasir Younas
    Mudasir Younas almost 5 years
    Thank you for pointing out, SciView feature of Pycharm will give you the same data visualization as Spyder, simply select the part of code you want to execute and press shift + alt + E to execute and then visualize in SciView by clicking on View as DataFrame.
  • Charlie Parker
    Charlie Parker over 4 years
    what I have is that in debugger mode there is both a console window and a debugger window but the debugger window does NOT show me what my print statements are printing. Which I find annoying. The ideal thing would be is both the debugger and the console in debug mode had the Variables watching panes. Is that not possible?
  • Charlie Parker
    Charlie Parker over 4 years
    is there a way to google more information about this functionality? Like what is the name of this functionality? Or you have a link to share?
  • Charlie Parker
    Charlie Parker over 4 years
    what if I want to see what is being printed to the console AND the variables at the same time?
  • Charlie Parker
    Charlie Parker over 4 years
    what I have is that in debugger mode there is both a console window and a debugger window but the debugger window does NOT show me what my print statements are printing. Which I find annoying. The ideal thing would be is both the debugger and the console in debug mode had the Variables watching panes. Is that not possible?
  • Maulik Madhavi
    Maulik Madhavi over 4 years
    @CharlieParker you can click to the "4:Run" and see the console stdout
  • TokyoToo
    TokyoToo about 4 years
    @SrinathGanesh My setup is Anaconda agnostic. Meaning 100% pyenv. But I'm thinking of installing miniconda so I can use Spyder and PyCharm together. Is there any risk of PATHs breaking when installing Anaconda since I already have pyenv/python 3.7 + 3.8 since Anaconda python is also 3.7? Can I just go ahead and install Anaconda?