2014-10-28 71 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