简体   繁体   中英

Can I change the look of pandas data frame in vscode jupyter notebook?

I saw people working with Jupyter notebook have quite nice view of the data frame. But my Jupyter notebook in VScode show the same thing as in the terminal. How do I change this? Would change the theme help?

Thank you.

Edit: thanks for your reply. Here is what I want: 图 1

Here is what it look like now: 图 2

I'm OK with any theme, as long as the data look clearer with row separation or at least header separation.

Panda's to_markdown function, which requires the tabulate library installed in python, provides various plain text formatting for tables which show on VS Code Jupyter editor, such as:

df = pd.DataFrame(data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]})
print(df.to_markdown())

|    | animal_1   | animal_2   |
|---:|:-----------|:-----------|
|  0 | elk        | dog        |
|  1 | pig        | quetzal    |

I reached the same case and tried setting up the Notebook extension to default. It worked for my case. You can see the detail here !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM