reset_index(
level: Union[Hashable, Sequence[Hashable], NoneType] = None,
drop: bool = False,
inplace: bool = False,
col_level: Hashable = 0,
col_fill: Union[Hashable, NoneType] = ‘‘,
) -> Union[ForwardRef(‘DataFrame‘), NoneType]
Docstring:
Reset the index, or a level of it.
Reset the index of the DataFrame, and use the default one instead.
If the DataFrame has a MultiIndex, this method can remove one or more
levels.
Parameters
----------
level : int, str, tuple, or list, default None
Only remove the given levels from the index. Removes all levels by
default.
drop : bool, default False
Do not try to insert index into dataframe columns. This resets
the index to the default integer index.
inplace : bool, default False
Modify the DataFrame in place (do not create a new object).
col_level : int or str, default 0
If the columns have multiple levels, determines which level the
labels are inserted into. By default it is inserted into the first
level.
col_fill : object, default ‘‘
If the columns have multiple levels, determines how the other
levels are named. If None then the index name is repeated.
Returns
-------
DataFrame or None
DataFrame with the new index or None if ``inplace=True``.
pandas --index ,reindex, set_index, reset_index , reindex_like函数 之 reset_index
原文:https://www.cnblogs.com/vincent-sh/p/12861608.html