Answers for "df drop range"

1

drop a range of rows pandas

#To delete rows 12 to 22 from the dataframe 
df.drop(range(12,23), inplace=True)
Posted by: Guest on September-05-2021
1

pandas drop column by index range

# drop columns 0 to 3
droprange = list(range(0, 4))
df.drop(df.columns[droprange], axis=1, inplace=True)
Posted by: Guest on May-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language