最終更新:2019-08-16 (金) 17:46:53 (1d)  

pandas.DataFrame はてなブックマークを見る
Top / pandas.DataFrame

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html

Two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns).

メモ

  • df.index : インデックスを取得
  • df.columns : カラム名を取得
  • df.values : 値をnumpy.ndarrayで取得
  • df.info() 「有効データ数」「データ型」「メモリ使用量」などの総合的な情報を表示
    df.index[0]最初の行のインデックス値
    df.index[-1]最後の行のインデックス値
    df['A']
    df[1:3]1 行目から3行目
    df[:3]先頭から 3 行目まで
    df['20130102':'20130104']行名を指定
    df.iloc[[1, 2],[0, 1]]1, 2行目の0, 1列
    df.loc[:, [“A”, “B”]]AとBの列を取り出す
    df.iloc[:, 0:1]すべての行の0~1列

属性

  • pandas.DataFrame.T?Transpose index and columns.
    pandas.DataFrame.at?Access a single value for a row/column label pair.
    pandas.DataFrame.axes?Return a list representing the axes of the DataFrame?.
    pandas.DataFrame.blocks?(DEPRECATED) Internal property, property synonym for as_blocks().
    pandas.DataFrame.columnsThe column labels of the DataFrame?.
    pandas.DataFrame.dtypes?Return the dtypes in the DataFrame?.
    pandas.DataFrame.empty?Indicator whether DataFrame? is empty.
    pandas.DataFrame.ftypes?(DEPRECATED) Return the ftypes (indication of sparse/dense and dtype) in DataFrame?.
    pandas.DataFrame.iat?Access a single value for a row/column pair by integer position.
    pandas.DataFrame.ilocPurely integer-location based indexing for selection by position.
    pandas.DataFrame.index?The index (row labels) of the DataFrame?.
    pandas.DataFrame.is_copy?Return the copy.
    pandas.DataFrame.ix?A primarily label-location based indexer, with integer position fallback.
    pandas.DataFrame.loc?Access a group of rows and columns by label(s) or a boolean array.
    pandas.DataFrame.ndim?Return an int representing the number of axes / array dimensions.
    pandas.DataFrame.shape?Return a tuple representing the dimensionality of the DataFrame?.
    pandas.DataFrame.size?Return an int representing the number of elements in this object.
    pandas.DataFrame.style?Property returning a Styler object containing methods for building a styled HTML representation fo the DataFrame?.
    pandas.DataFrame.values?Return a Numpy representation of the DataFrame?.

繰り返し処理

参考