parameters: (self, level=None, drop=False, name=None, inplace=False)
docstring: Generate a new DataFrame or Series with the index reset.
  
          This is useful when the index needs to be treated as a column, or
          when the index is meaningless and needs to be reset to the default
          before another operation.
  
          Parameters
          ----------
          level : int, str, tuple, or list, default optional
              For a Series with a MultiIndex, only remove the specified levels
              from the index. Removes all levels by default.
          drop : bool, default False
              Just reset the index, without inserting it as a column in
              the new DataFrame.
          name : object, optional
              The name to use for the column containing the original Series
              values. Uses ``self.name`` by default. This argument is ignored
              when `drop` is True.
          inplace : bool, default False
              Modify the Series in place (do not create a new object).
  
          Returns
          -------
          Series or DataFrame
              When `drop` is False (the default), a DataFrame is returned.
              The newly created columns will come first in the DataFrame,
              followed by the original Series values.
              When `drop` is True, a `Series` is returned.
              In either case, if ``inplace=True``, no value is returned.
  
          See Also
          --------
          DataFrame.reset_index: Analogous function for DataFrame.
  
          Examples
          --------
          >>> s = pd.Series([1, 2, 3, 4], name='foo',
          ...               index=pd.Index(['a', 'b', 'c', 'd'], name='idx'))
  
          Generate a DataFrame with default index.
  
          >>> s.reset_index()
            idx  foo
          0   a    1
          1   b    2
          2   c    3
          3   d    4
  
          To specify the name of the new column use `name`.
  
          >>> s.reset_index(name='values')
            idx  values
          0   a       1
          1   b       2
          2   c       3
          3   d       4
  
          To generate a new Series with the default set `drop` to True.
  
          >>> s.reset_index(drop=True)
          0    1
          1    2
          2    3
          3    4
          Name: foo, dtype: int64
  
          To update the Series in place, without generating a new one
          set `inplace` to True. Note that it also requires ``drop=True``.
  
          >>> s.reset_index(inplace=True, drop=True)
          >>> s
          0    1
          1    2
          2    3
          3    4
          Name: foo, dtype: int64
  
          The `level` parameter is interesting for Series with a multi-level
          index.
  
          >>> arrays = [np.array(['bar', 'bar', 'baz', 'baz']),
          ...           np.array(['one', 'two', 'one', 'two'])]
          >>> s2 = pd.Series(
          ...     range(4), name='foo',
          ...     index=pd.MultiIndex.from_arrays(arrays,
          ...                                     names=['a', 'b']))
  
          To remove a specific level from the Index, use `level`.
  
          >>> s2.reset_index(level='a')
                 a  foo
          b
          one  bar    0
          two  bar    1
          one  baz    2
          two  baz    3
  
          If `level` is not set, all levels are removed from the Index.
  
          >>> s2.reset_index()
               a    b  foo
          0  bar  one    0
          1  bar  two    1
          2  baz  one    2
          3  baz  two    3
docstring_summary: Generate a new DataFrame or Series with the index reset.
docstring_tokens: Generate a new DataFrame or Series with the index reset .
function: def reset_index(self, level=None, drop=False, name=None, inplace=False):
          """
          Generate a new DataFrame or Series with the index reset.
  
          This is useful when the index needs to be treated as a column, or
          when the index is meaningless and needs to be reset to the default
          before another operation.
  
          Parameters
          ----------
          level : int, str, tuple, or list, default optional
              For a Series with a MultiIndex, only remove the specified levels
              from the index. Removes all levels by default.
          drop : bool, default False
              Just reset the index, without inserting it as a column in
              the new DataFrame.
          name : object, optional
              The name to use for the column containing the original Series
              values. Uses ``self.name`` by default. This argument is ignored
              when `drop` is True.
          inplace : bool, default False
              Modify the Series in place (do not create a new object).
  
          Returns
          -------
          Series or DataFrame
              When `drop` is False (the default), a DataFrame is returned.
              The newly created columns will come first in the DataFrame,
              followed by the original Series values.
              When `drop` is True, a `Series` is returned.
              In either case, if ``inplace=True``, no value is returned.
  
          See Also
          --------
          DataFrame.reset_index: Analogous function for DataFrame.
  
          Examples
          --------
          >>> s = pd.Series([1, 2, 3, 4], name='foo',
          ...               index=pd.Index(['a', 'b', 'c', 'd'], name='idx'))
  
          Generate a DataFrame with default index.
  
          >>> s.reset_index()
            idx  foo
          0   a    1
          1   b    2
          2   c    3
          3   d    4
  
          To specify the name of the new column use `name`.
  
          >>> s.reset_index(name='values')
            idx  values
          0   a       1
          1   b       2
          2   c       3
          3   d       4
  
          To generate a new Series with the default set `drop` to True.
  
          >>> s.reset_index(drop=True)
          0    1
          1    2
          2    3
          3    4
          Name: foo, dtype: int64
  
          To update the Series in place, without generating a new one
          set `inplace` to True. Note that it also requires ``drop=True``.
  
          >>> s.reset_index(inplace=True, drop=True)
          >>> s
          0    1
          1    2
          2    3
          3    4
          Name: foo, dtype: int64
  
          The `level` parameter is interesting for Series with a multi-level
          index.
  
          >>> arrays = [np.array(['bar', 'bar', 'baz', 'baz']),
          ...           np.array(['one', 'two', 'one', 'two'])]
          >>> s2 = pd.Series(
          ...     range(4), name='foo',
          ...     index=pd.MultiIndex.from_arrays(arrays,
          ...                                     names=['a', 'b']))
  
          To remove a specific level from the Index, use `level`.
  
          >>> s2.reset_index(level='a')
                 a  foo
          b
          one  bar    0
          two  bar    1
          one  baz    2
          two  baz    3
  
          If `level` is not set, all levels are removed from the Index.
  
          >>> s2.reset_index()
               a    b  foo
          0  bar  one    0
          1  bar  two    1
          2  baz  one    2
          3  baz  two    3
          """
          inplace = validate_bool_kwarg(inplace, "inplace")
          if drop:
              new_index = ibase.default_index(len(self))
              if level is not None:
                  if not isinstance(level, (tuple, list)):
                      level = [level]
                  level = [self.index._get_level_number(lev) for lev in level]
                  if len(level) < self.index.nlevels:
                      new_index = self.index.droplevel(level)
  
              if inplace:
                  self.index = new_index
                  # set name if it was passed, otherwise, keep the previous name
                  self.name = name or self.name
              else:
                  return self._constructor(
                      self._values.copy(), index=new_index
                  ).__finalize__(self)
          elif inplace:
              raise TypeError(
                  "Cannot reset_index inplace on a Series to create a DataFrame"
              )
          else:
              df = self.to_frame(name)
              return df.reset_index(level=level, drop=drop)
function_tokens: def reset_index ( self , level = None , drop = False , name = None , inplace = False ) : inplace = validate_bool_kwarg ( inplace , "inplace" ) if drop : new_index = ibase . default_index ( len ( self ) ) if level is not None : if not isinstance ( level , ( tuple , list ) ) : level = [ level ] level = [ self . index . _get_level_number ( lev ) for lev in level ] if len ( level ) < self . index . nlevels : new_index = self . index . droplevel ( level ) if inplace : self . index = new_index # set name if it was passed, otherwise, keep the previous name self . name = name or self . name else : return self . _constructor ( self . _values . copy ( ) , index = new_index ) . __finalize__ ( self ) elif inplace : raise TypeError ( "Cannot reset_index inplace on a Series to create a DataFrame" ) else : df = self . to_frame ( name ) return df . reset_index ( level = level , drop = drop )