我在Jupyter Lab中使用的是熊猫0.25.1,无论pd.options.display.max_rows
设置为多少,我最多可以显示10行。
但是,如果pd.options.display.max_rows
设置为小于10,则生效;如果pd.options.display.max_rows = None
,则所有行都显示。
您知道如何让超过10的pd.options.display.max_rows
生效吗?
答案 0 :(得分:6)
pandas v0.25.1
的最终答案max_rows
设置为大于DataFrame
中的行数。min_rows
设置为大于10。 pd.set_option('display.max_rows', x)
和pd.options.display.max_rows = x
(其中x是某个数字)都应该起作用。
Jupyter Lab
pandas
选项:pd.set_option('display.max_columns', 200)
pd.set_option('display.max_rows', 100)
pd.set_option('display.min_rows', 100)
pd.set_option('display.expand_frame_repr', True)
get.options
返回当前值:pd.get_option("display.max_rows")
DataFrame
中的行数,则该设置仅显示更多行。
pd.set_option('display.max_rows', 100)
,但DataFrame
有200行,则只会显示10行。pd.set_option('display.max_rows', 200)
,但DataFrame
有100行,则将显示所有100行。display.max_rows
:默认= 60
display.min_rows
:默认= 10
display.large_repr
:默认=截断
max_rows
/ max_cols
的DataFrame,repr(和HTML repr)可以显示截断的表(默认值),或者从df.info()
切换到视图(早期版本的熊猫)。允许的设置[[truncate],“ info”] 答案 1 :(得分:-1)
min_rows 显示要从顶部(头部)和底部(尾部)开始显示的行数,它将被平均分割......尽管输入的是奇数。如果只想显示一定数量的行而不将其读入内存,
另一种方法是使用 nrows = 'putnumberhere'
。
e.g. results = pd.read_csv('ex6.csv', nrows = 5) # display 5 rows from the top 0 - 4
如果数据框有大约 100 行并且您只想显示从顶部开始的前 5 行...NO TAIL 使用 .nrows