我有一個DataFrame
,我想使用pd.Series.value_counts()
在某個Series
中顯示特定值的頻率。如何在使用pd.Series.value_counts()時停止Jupyter輸出截斷結果?
問題是我只在輸出中看到截斷的結果。我在Jupyter Notebook編碼。
我已經失敗嘗試了幾個方法:
df = pd.DataFrame(...) # assume df is a DataFrame with many columns and rows
# 1st method
df.col1.value_counts()
# 2nd method
print(df.col1.value_counts())
# 3rd method
vals = df.col1.value_counts()
vals # neither print(vals) doesn't work
# All output something like this
value1 100000
value2 10000
...
value1000 1
目前,這是我使用的是什麼,但它是非常麻煩
print(df.col1.value_counts()[:50])
print(df.col1.value_counts()[50:100])
print(df.col1.value_counts()[100:150])
# etc.
而且,我已經閱讀this相關堆棧溢出問題,但沒有發現它有幫助。
那麼如何停止輸出截斷結果呢?