出于某种原因,每当我通过从文件中读取数据在 pandas 中创建数据框时,我都没有网格线:
我已经检查了所有显示属性的 pd.options 设置,所有内容均设置为默认值。谁能帮助我更改数据框的格式?即使我在 jupyter 笔记本中打开新的 python 笔记本,也会发生这种格式。
最佳答案
添加此内容并从单元格运行
%%HTML
<style type="text/css">
table.dataframe td, table.dataframe th {
border: 1px black solid !important;
color: black !important;
}
使用df
代替print(df)
来源:MEdwin 的回答在这里Python Jupyter Notebook print dataframe borders
关于python - Pandas Dataframe 显示缺失的网格线(Jupyter Notebook),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52433640/