python - Is there an easier way to change the index values of a pandas dataframe? -


i taking dataframe, breaking 2 dataframes, , need change index values no number greater total number of rows.

here's code:

dataset =   pd.read_csv("dataset.csv",usecols['row_id','x','y','time'],index_col=0) splitvalue = math.floor((0.9)*786239) train = dataset[dataset.time < splitvalue] test = dataset[dataset.time >= splitvalue] 

here's change doing. wondering if there easier way:

test.index=range(test.shape[0]) test.index.rename('row_id',inplace=true) 

is there better way this?

try:

test = test.reset_index(drop=true).rename_axis('row_id') 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -