When using PyCharm for debugging data science code, I often want to view a Pandas DataFrame from PyCharm's interactive debugger. It took me a bit to figure out how to do this from the keyboard — here's what I do:
- While debugging, open the "Evaluate" window (bound to
cmd-;
in my configuration). - Type in the name of the variable for the DataFrame and press
enter
, which gives me this: - Now the question is how to activate the "View as DataFrame" button with the keyboard (see green arrow above). Turns out you can bind "View as Array" to a keyboard shortcut, which will also trigger "View as DataFrame". So I
tab
from the "Expression" text field to the "Results" area and then hit my "View as Array" shortcut (cmd-enter
). This opens the DataFrame in SciView.
Here's the "View as Array" keyboard shortcut configuration:
I've found "floating mode" to work best with SciView. cmd-w
will close SciView in floating mode, but for some reason when I do this, the "Evaluate" window will lose focus and I can't figure out how to focus it again without mousing. Keyboard Meastro to the rescue here: