打印命令不显示所有内容

时间:2014-10-28 21:32:37

标签: python python-2.7 pandas

我正在尝试查看数据的所有内容,但在输入

之后
print "location_country" , df['loan_amount'].describe()

显示的输出不完整。我和" ..."那就是:

Albania           count    1158.000000
                  mean     1466.364421
                  std      1698.249173
                  min       450.000000
                  25%       950.000000
                  50%      1375.000000
                  75%      1900.000000
...
Zambia            mean     2103.071672
                  std      1688.244747
                  min       375.000000
                  25%       550.000000
                  50%      1475.000000
                  75%      3025.000000
                  max      6625.000000

Length: 688, dtype: float64
stats_country

我不知道如何使所有应该打印的数据可见。

1 个答案:

答案 0 :(得分:2)

您可以使用pd.set_option修改默认显示的行数(以及许多其他选项)。例如:

>>> df = pd.DataFrame({"country": list(string.ascii_uppercase)*10, "loan_amount": range(260)})
>>> df.groupby("country")["loan_amount"].describe()

显示AB,然后显示...,然后显示YZ,但

>>> pd.set_option("display.max_rows", 1000)
>>> df.groupby("country")["loan_amount"].describe()

显示

country       
A        count     10.000000
         mean     117.000000
         std       78.718909
         min        0.000000
         25%       58.500000
         50%      117.000000
         75%      175.500000
         max      234.000000
[I'm skipping B through I here, they're really shown]
J        count     10.000000
         mean     126.000000
         std       78.718909
         min        9.000000
         25%       67.500000
         50%      126.000000
         75%      184.500000
         max      243.000000
[same thing, I'm skipping K through Y]
Z        count     10.000000
         mean     142.000000
         std       78.718909
         min       25.000000
         25%       83.500000
         50%      142.000000
         75%      200.500000
         max      259.000000
Length: 208, dtype: float64
相关问题