Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

reset_index pandas

df.reset_index(drop=True, inplace=True)
Comment

reset_index(drop=true)

In [194]: df.reset_index(drop=True)
Out[194]: 
  _worker_id  foo
0          A    1
1          B    2
2          C    3
Comment

Example 1: Reset Index & Drop Old Index pandas

import pandas as pd

#define DataFrame
df = pd.DataFrame({'points': [25, 12, 15, 14, 19, 23, 25, 29],
                   'assists': [5, 7, 7, 9, 12, 9, 9, 4],
                   'rebounds': [11, 8, 10, 6, 6, 5, 9, 12]},
                   index=[0, 4, 3, 5, 2, 1, 7, 6])

#view DataFrame
print(df)

   points  assists  rebounds
0      25        5        11
4      12        7         8
3      15        7        10
5      14        9         6
2      19       12         6
1      23        9         5
7      25        9         9
6      29        4        12
Comment

PREVIOUS NEXT
Code Example
Python :: convert np shape (a,) to (a,1) 
Python :: flask cookies 
Python :: django response headers 
Python :: change marker border color plotly 
Python :: Converting Dataframe from the multi-dimensional list 
Python :: matplotlib orange line 
Python :: split python strings into pairs & complete uneven pairs 
Python :: python 3d array 
Python :: scipy cosine similarity 
Python :: raspberry pi keyboard python input 
Python :: python dequeu 
Python :: PackagesNotFoundError: The following packages are not available from current channels: 
Python :: picasa 
Python :: python look up how many rows in dataframe 
Python :: python pow 
Python :: python align label left 
Python :: remove multiindex pandas 
Python :: find the highest id in model django 
Python :: python offline translate pypi 
Python :: python functions with input 
Python :: python loop back to start 
Python :: echo $pythonpath ubuntu set default 
Python :: how to read panda column 
Python :: how to dump a database using manage.py 
Python :: gspread_pandas pypi 
Python :: python see if a number is greater than other 
Python :: python check if list 
Python :: Python NumPy copyto function example 
Python :: append object python 
Python :: pandas rename column by dictionary 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =