numpy series reset index

>>> s.reset_index(inplace=True, drop=True)
>>> s
0    1
1    2
2    3
3    4
Name: foo, dtype: int64

Here is what the above code is Doing:
1. We create a DataFrame with a column of integers.
2. We create a Series with the same data.
3. We reset the index of the DataFrame.
4. We reset the index of the Series.

The result is that the Series and DataFrame have the same index.

You can also use the reset_index method to reset the index of a DataFrame and create a new column with the old index values.

>>> df = pd.DataFrame({‘foo’: [1,2,3,4]})
>>> df
foo
0 1
1 2
2 3
3 4

>>> df.reset_index(inplace=True)
>>> df
index foo
0 0 1
1 1 2
2 2 3
3 3 4

You can also use the reset_index method to reset the index of a DataFrame and create a new column with the old index values.

>>> df = pd.DataFrame({‘foo’: [1,2,3,4]})
>>> df
foo
0 1
1 2
2 3
3 4

>>> df.reset_index(inplace=True)
>>> df
index foo
0 0 1
1 1 2
2 2 3
3 3 4

You can also use the reset_index method to reset the index of a DataFrame and create a new column with the old index values.

>>> df = pd.DataFrame({‘foo’: [1,2,3,4]})
>>> df
foo
0 1
1 2
2 3
3 4

>>> df.reset_index(inplace=True)
>>> df
index foo
0 0 1
1 1 2
2 2 3
3 3 4