Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
import numpy as np
import pandas as pdMax Number of Columns to Display¶
pd.options.display.max_columns = 100Max Number of Rows to Display¶
pd.options.display.max_rows = 500Max 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.
pd.options.display.max_colwidth = 100Set pd.options.display.max_colwidth to None
which imposes no limit.
pd.options.display.max_colwidth = Nonedf = pd.DataFrame(
{
"id": [1, 2, 3, 4, 5],
"link": [
"http://a_super_loooooooooooooooooooooooooooooooong_link.com",
"",
"",
"",
"",
],
}
)
dfdfDisplay Formatting of Floating Numbers¶
df = pd.DataFrame(np.random.randint(100, 10000, size=(4, 2)), columns=["a", "b"])
df.head()df.dtypesa int64
b int64
dtype: objectpd.options.display.float_format = "{:,}".formatdfdir(pd.options.display)['chop_threshold',
'colheader_justify',
'column_space',
'date_dayfirst',
'date_yearfirst',
'encoding',
'expand_frame_repr',
'float_format',
'height',
'html',
'large_repr',
'latex',
'line_width',
'max_categories',
'max_columns',
'max_colwidth',
'max_info_columns',
'max_info_rows',
'max_rows',
'max_seq_items',
'memory_usage',
'multi_sparse',
'notebook_repr_html',
'pprint_nest_depth',
'precision',
'show_dimensions',
'unicode',
'width']Display Formatting for Integers¶
https://
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.tailor 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.