In [5]:
import numpy as np
import pandas as pd
Max Number of Columns to Display¶
In [3]:
pd.options.display.max_columns = 100
Max Number of Rows to Display¶
In [4]:
pd.options.display.max_rows = 500
Max Column Width to Display¶
You can control the max column width of pandas display
using the option pd.options.display.max_colwidth
.
Set pd.options.display.max_colwidth
to a specific limit.
In [3]:
pd.options.display.max_colwidth = 100
Set pd.options.display.max_colwidth
to None
which imposes no limit.
In [3]:
pd.options.display.max_colwidth = None
In [4]:
df = pd.DataFrame(
{
"id": [1, 2, 3, 4, 5],
"link": [
"http://a_super_loooooooooooooooooooooooooooooooong_link.com",
"",
"",
"",
"",
],
}
)
df
Out[4]:
In [2]:
df
Out[2]:
Display Formatting of Floating Numbers¶
In [10]:
df = pd.DataFrame(np.random.randint(100, 10000, size=(4, 2)), columns=["a", "b"])
df.head()
Out[10]:
In [11]:
df.dtypes
Out[11]:
In [12]:
pd.options.display.float_format = "{:,}".format
In [13]:
df
Out[13]:
In [8]:
dir(pd.options.display)
Out[8]:
Display Formatting for Integers¶
https://stackoverflow.com/questions/29663252/format-pandas-integers-for-display
Styling¶
- Avoid applying styling on large pandas DataFrames,
as pandas styling (using
DataFrame.style.format
) is extremely slow on large data frames. It is suggested that you always useDataFrame.head
,DataFrame.tail
or filtering to limit the size of a DataFrame before applying styling to it. Another good way is to display a pandas DataFrame using a widget extension. For more details, please refer to JupyterLab Extensions for Spreadsheet.
In [ ]:
In [ ]: