jupyter notebook vscode doesn't display dataframe right - visual-studio-code

I used to always have my dataframes displayed correctly in a nice table in jupyter notebook but now everytime I display one, it's like I printed it unformated.
I tried to use display(df_main) but it's still not displaying it correctly.

Related

Display cell scrollbar in Jupyter Notebook on GitHub

A cell output in one of my Jupyter notebooks has a vertical scrollable side bar. When I added this notebook to my GitHub repository, the full output (which takes up a lot of space) was displayed. Is it possible for GitHub to display the cell output with a sidebar?
Below is a minimal working example illustrating the problem. Here is a screenshot of a cell in a Jupyter Notebook that has a scrollbar:
If this notebook is converted to HTML via jupyter nbconvert --to html name.ipynb and viewed in a browser (to replicate publishing and viewing the notebook on GitHub), then the output looks like this (there is no scrollbar):
I found the following related links, but no one has posted a solution yet:
How to get a vertical scrollbar in HTML output from Jupyter notebooks
How to add a vertical scrollbar in html output from jupyter notebook with nbconvert?
Any help would be appreciated!

running multiple cells in vscode

How to run multiple selected code chunks of Jupyter notebook in VScode IDE?
After selecting some consecutive code cells with Shift+Down Arrow, how do I run the cells?
This is easily done in Jupyter notebook IDE but I can not figure it out in VScode IDE.
Perhaps this didn't always work, but I can run consecutive selected shells using Shift+Enter, same as running a single selected cell.

jupyter notebook display cells horizontal

I have issues on jupyter notebook conversion. It looks fine on jupyter notebook. However if I convert it to html or upload to github, it displays like photo above.
Instead of vertical(scroll up and down), I have to scroll left and right and each cell are really narrowed.
Any suggestion?
Thanks in advance!
This is typical of a library you use emitting invalid HTML. I would suggest opening an issue or contacting the Jupyter mailing list to help you debug this as StackOverflow will not be the right place to have a back and forth.
You should be able to narrow down which library does that by:
- backup your notebook.
- Delete cells one and until notebook looks normal. (tip use nbconvert locally instead of uploading, and use python -m http.server)
- the last cell you delete have a issue.
It may be a bug in nbconvert but I doubt it.

keep cell metadata in a copy of a jupyter notebook?

I'm working on a jupyter notebook (from a local installation of jupyterhub) that I want to be able to copy and distribute to my coworkers. Some of them are a little 'code-phobic' so I want to be able to portions of the code from them.
I can use the hide input extension to very prettily hide the code in my own notebook, however when I make a copy the cell meta-data for hide input reverts to "hide_input": false, and the code is all automatically visible.
Is there a way to keep cell meta data in the copying process?
I can find a lot of online discussions/documentation about keeping hide input functionality with nbconvert, however I don't want to convert to html because I still need the users to be able to actually run code.
Is there a way to use nbconvert to make a copy of a notebook and not actually convert it?
Thanks.
I'm confused - because for me cell metadata is preserved when copied. Are you sure you are actually saving the notebook after you have changed the cell metadata?
Regardless, you can use nbconvert to "convert" a notebook into a notebook; use the command:
jupyter nbconvert --to notebook --execute mynotebook.ipynb
From the docs: https://nbconvert.readthedocs.io/en/latest/usage.html#notebook-and-preprocessors
If you use the Toggle selected cell input button or individually edit cell metadata the individual cell hide input status was not preserved. But when I used the Hide codecell inputs to hide the input of all the cells; then it was preserved after copying.

pre-filled cells in new ipython notebook

When I make a new ipython notebook, I would like to have a pre-filled one.
By pre-filled, I mean that instead of a first blank cell, I would like in it a custom code like
import os
import sys
...
In other words, I do not want to type or copy/paste in every notebook the same piece of code I use 90% of my time.
I do not want this code to be executed behind the scene. It should appear in the notebook.