理解pandas.DataFrame.reindex

  • reindex

    DataFrame.reindex(self, labels=None, index=None, columns=None, axis=None, method=None, copy=True, level=None, fill_value=nan, limit=None, tolerance=None)

    Conform DataFrame to new index with optional filling logic.

  • Parameters

    Parameters type meaning
    labels array-like New labels/index to conform the axis specified by “axis” to
    index, columns array-like
    axis int or str Axis to target, (‘index’, ‘columns’) (0,1)
    method {None, ‘backfill’/‘bfill’, ‘pad’/‘ffill’, ‘nearest’}
    copy bool
    level int or name
    fill_value scalar, default np.NaN
    limit int, default None
    tolerance optional
  • References

  1. API reference
  2. Essential basic functionality : Reindexing and altering labels
  3. GeeksforGeeks
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章