I have created a dataframe 'new' in which I have selected every 10th row and named that as 'x_test1'. Now I want these selected rows (every 10th row) to be deleted from the previously existing dataframe 'new'. Basically I want two separate dataframes:-
Here's what I have tried:
x_test1 = new.iloc[::10,:] #select every 10th row from 'new' dataframe
dataset = new.drop([x_test1], axis = 0) #returns Value Error
Can someone please advise me on this?
Use drop
by index values:
x_test1 = new.iloc[::10]
dataset = new.drop(x_test1.index)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.