2016-11-24 216 views

回答

2

我沒有給你一個明確的答案。有一兩件事我注意到的是,DataFrame.hist返回軸對象和DataFrame.plot.hist只返回一個列表。例如:

# Making up data 
df = pd.DataFrame({'value1': np.random.normal(1, 1, 99), 
        'value2': [-1]*33 + [0]*33 + [1]*33}) 

df.hist() 

enter image description here

df.plot.hist() 

enter image description here

2

望着文檔,http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.DataFrame.plot.hist.htmlhttp://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.hist.html,它看起來像plot.hist是一個函數,需要幾直方圖具體方案,但隨後經過對所有其他關鍵字參數傳遞給plot(),而HIST直接花費大量關鍵字參數的個數。我想這主要是爲了創建一個更簡單,更一致的API,而不是具有15個不同的功能,每個功能都需要大量的kwargs,只關注專門的參數,其餘與plot()一致

cf :

在新版本0.17.0或更新:每個情節種類對 的相應方法的DataFrame.plot存取:df.plot(種類= '線')相當於 df.plot.line()

另外, N,情節*函數返回axes,這可能是鏈接和其他有用的東西。

+0

實際上舊式函數返回的軸以及 – maxymoo

+0

沒錯,但如果有多個列返回軸的陣列,而不是(如在另一個答案指出),所以它可能不會是鏈接一樣方便。 – OldGeeksGuide