Home > Net >  Drop specific rows in a dataframe
Drop specific rows in a dataframe

Time:11-29

I would like to drop two problematic lines into the dataframe but it gives me an error. (I guess it is very simple but my level of programming is very very low)

Code :

import pandas as pd
members = pd.read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-09-22/members.csv")

The error :

members = members.drop(members[(members["injury_height_metres"]>8850)])

CodePudding user response:

You need to pass the index when dropping rows:

members = members.drop(members[(members["injury_height_metres"]>8850)].index)
  • Related