Home > Net >  Find and Delete out of range data from dataframe
Find and Delete out of range data from dataframe

Time:07-04

I am working with Latitude and Longitude dataset (pandas dataframe). I tried to find minimum and maximum values of latitude and longitude to get a bounding box and export the image of the area from Open Street Map. The results is showing out of range data and I want to find and remove all of out of range data from my dataset. Not sure what is the best way of doing this.

Thanks for any help.

CodePudding user response:

I think you can use np.where. For e.g. you want to filter out longitude & latitude of certain range, you can use this in way

np.where((df['longitude']>=100) & (df['latitude']<=100) | (df['longitude']<=100) & (df['latitude']>=100)  )

Ofcourse you need to modify range/column name & equality logic based on the requirement.

More information will certainly help in answer question better.

  • Related