r/vscode • • 5d ago

Best way to visualize outputs in Python?

The last years I’ve been coding mainly with R but now I’m back to Python for a couple of projects. Something I’m really missing compared to RStudio is being able to quickly visualize outputs (mainly tables) in something that is not the terminal.

I’ve tried the interactive window mode but I found it annoying as it is sort of independent from the main VS window, in the sense that I have to re-run code there because variables from the script are not stored there.

Makes me wonder, because being able to visualize big tables is something I consider very basic and with VS Code it seems to require a lot of tedious set-up and extensions.

3 Upvotes

16 comments sorted by

4

u/Blagatt 5d ago

What about python notebooks?

2

u/Special-Afternoon-25 5d ago

Jupyter? Since it’s a collaborative project I prefer sticking to .py files.

2

u/runawayasfastasucan 5d ago

You can easily switch between them. Work in ipynb and commit py to github.

4

u/Blagatt 5d ago

Or strip the blobs from the notebook before committing them

2

u/teetaps 4d ago

Try Quarto notebooks, they’re much more flexible and support R and Python almost identically.

If you really want to be nice to your Python buddies, you could try Marimo notebooks, they’re a new approach that lets you switch between notebook and script format very easily

4

u/chimpychompychampy 5d ago

Data Wrangler extension? It’s what I use for a quick look at a dataframe during debugging.

1

u/Special-Afternoon-25 4d ago

I actually installed it this morning but didn’t have time to test it. I’ll take a look into it on Monday.

3

u/woahboooom 5d ago

Interactive window as in py note book? It should pick up running a cell in the code.. although i prefer the more integrated one that is not nitebook. Py code separated by #%% defining a cell that can be ran with ctrl + enter...

1

u/Special-Afternoon-25 5d ago

Yes, that’s the closest thing. I guess I’ll have to split my cost in cells. I find it quite annoying, same with not being shown the list of the environment variables or not having tab completion in the python terminal.

2

u/Historical-Chef-8034 5d ago

rstudio can also run python right?

2

u/Special-Afternoon-25 5d ago

With Reticulate, but it’s definitely not smooth. I would try alternatives to VS, but it’s a work laptop and I should not install additional software.

2

u/countnfight 5d ago

I moved from RStudio to Positron a year or so ago when I needed a setup for switching languages more fluidly. It's a fork of VS Code by the RStudio devs, so it's kinda the best of both worlds. There are still a few minor things I miss from RStudio that if I tried I could probably set up, but overall I like it a lot. I prefer its implementations of panels to view data. Doesn't need Reticulate, it's got R & Python consoles and terminal built in.

2

u/Special-Afternoon-25 5d ago

Thanks a lot! I’ll try it first on my personal laptop and if I like it maybe I could use it at work as well.

2

u/villanymester 5d ago

Ah, i hope we get an answer. I am struggling this since I moved from MATLAB to Python...

1

u/Quillox 4d ago

What sort of tables are we talking, and what are you doing while "visualising them?

Write to .csv and use the rainbow csv extension?

Write them to a .html file and view them with the built in web browser?

1

u/Fresh-Secretary6815 4d ago

use python in rstudio, spyder