Series.reset_index
时间: 2024-05-20 13:19:36 浏览: 13
Series.reset_index is a method in pandas library that is used to reset the index of a pandas Series. By default, the method creates a new DataFrame with the original index being added as a new column. The new index is set to the default range index starting from 0.
Syntax:
Series.reset_index(level=None, drop=False, name=None, inplace=False)
Parameters:
- level: It is an optional parameter that is used to specify the level(s) to be reset. If not specified, all levels are reset.
- drop: It is a boolean parameter that is used to drop the index column(s) after reset. If set to True, the index column(s) are dropped, and only the new range index is used. If set to False, the index column(s) are kept.
- name: It is an optional parameter that is used to specify the name of the new index column.
- inplace: It is a boolean parameter that is used to specify whether to modify the original Series or return a new Series.
Returns:
- A new DataFrame if inplace=False. Otherwise, None is returned, and the original Series is modified.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)