2014-10-28 73 views
0

我想看看我的数据的所有内容,但我型打印命令不会显示一切

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

这大概是使用大熊猫。这是一个重要的区别。 – 2014-10-28 21:34:01

+0

因为熊猫(numpy真的但是meh)彬彬有礼地假定你不想要一百万行吐出来...... – 2014-10-28 21:35:37

回答

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