Python, pandas, dtypes, count(), mean(), head()の違い
データフレームのmethod
で帰ってくる値が、型がちょい違うので、メモメモ。
In [166]: df = pd.DataFrame(np.random.randn(10,10)) In [167]: a = df.dtypes In [168]: b = df.count() In [169]: c = df.mean() In [170]: d = df.head(1) In [171]: whos Variable Type Data/Info -------------------------------------------- a Series 0 float64\n1 float6<...> float64\ndtype: object b Series 0 10\n1 10\n2 10<...>10\n9 10\ndtype: int64 c Series 0 0.139971\n1 0.139<...>-0.179344\ndtype: float64 d DataFrame 0 1 <...>571 -0.776965 -1.946434
ちゅうことで、head()
はDataFrame
で帰ってくる。
まあ、あたりまえか、、head(2)
とかで2行ゲットの場合とかあるし。。。