I am taking a dataframe, breaking it into two dataframes, and then I need to change the index values so that no number is greater than the total number of rows.
Here's the 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 the change that I am doing. I am wondering if there is an easier way:
test.index=range(test.shape[0])
test.index.rename('row_id',inplace=True)
Is there a better way to do this?