MCPcopy Create free account
hub / github.com/dask/dask / reset_index

Method reset_index

dask/dataframe/dask_expr/_collection.py:653–673  ·  view source on GitHub ↗

Reset the index to the default index. Note that unlike in ``pandas``, the reset index for a Dask DataFrame will not be monotonically increasing from 0. Instead, it will restart at 0 for each partition (e.g. ``index1 = [0, ..., 10], index2 = [0, ...]``). This is due t

(self, drop: bool = False)

Source from the content-addressed store, hash-verified

651 self._expr = _expr
652
653 def reset_index(self, drop: bool = False):
654 """Reset the index to the default index.
655
656 Note that unlike in ``pandas``, the reset index for a Dask DataFrame will
657 not be monotonically increasing from 0. Instead, it will restart at 0
658 for each partition (e.g. ``index1 = [0, ..., 10], index2 = [0, ...]``).
659 This is due to the inability to statically know the full length of the
660 index.
661
662 For DataFrame with multi-level index, returns a new DataFrame with
663 labeling information in the columns under the index names, defaulting
664 to 'level_0', 'level_1', etc. if any are None. For a standard index,
665 the index name will be used (if set), otherwise a default 'index' or
666 'level_0' (if 'index' is already taken) will be used.
667
668 Parameters
669 ----------
670 drop : boolean, default False
671 Do not try to insert index into dataframe columns.
672 """
673 return new_collection(expr.ResetIndex(self, drop))
674
675 def head(self, n: int = 5, npartitions=1, compute: bool = True):
676 """First n rows of the dataset

Callers 15

idxmaxmin_combineFunction · 0.80
_mode_aggregateFunction · 0.80
assert_eqFunction · 0.80
group_split_pandasFunction · 0.80
concat_pandasFunction · 0.80
_cov_chunkFunction · 0.80
_metaMethod · 0.80
_metaMethod · 0.80
_calculate_divisionsFunction · 0.80
to_parquetFunction · 0.80
test_groupby_rollingFunction · 0.80

Calls 1

new_collectionFunction · 0.90