简体   繁体   English

我可以在 vscode jupyter notebook 中更改 pandas 数据框的外观吗?

[英]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.我看到使用 Jupyter notebook 的人对数据框的看法非常好。 But my Jupyter notebook in VScode show the same thing as in the terminal.但是我在 VScode 中的 Jupyter notebook 显示的内容与在终端中显示的内容相同。 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: Panda 的to_markdown函数需要在 python 中安装tabulate库,为在 VS Code Jupyter 编辑器上显示的表格提供各种纯文本格式,例如:

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 !你可以在这里看到细节!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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