赞
踩
I'm probably have a simple question but I can't seem to find a solution online.
If I create a dataframe "df" in a Jupyter notebook and then I print it out using print(), the table displayed in my broswer does not show any borders at all.
For example:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(5,2), columns=["a","b"])
print(df)
This will show a table with no border.
I read Jupyter pandas.DataFrame output table format configuration
but that seems to help if I simply type
df.head()
not the output of the print() function.
Does somebody have any suggestions?
Many thanks
解决方案
@Angel, you can add this script in any cell to introduce table borders. Use df instead of print(df)
%%HTML
table.dataframe td, table.dataframe th {
border: 1px black solid !important;
color: black !important;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。