【发布时间】:2018-11-05 20:27:59
【问题描述】:
我想根据函数是否返回true来删除一行,该函数检查纬度和经度值是否在陆地上。我想删除纬度/经度返回假的行。
这是我目前所拥有的,但我卡住了:
def LAND_SHAPE_READER():
land_shp_fname = shpreader.natural_earth(resolution='10m',
category='physical',
name='land')
land_geom = unary_union(list(shpreader.Reader(land_shp_fname).geometries()))
land = prep(land_geom)
def IS_LAND(x, y):
return land.contains(sgeom.Point(x, y))
def MAP_PLOT_CHECK():
if IS_LAND(df['Longitude'], df['Latitude']):
return
else:
#drop row here
【问题讨论】:
标签: python python-3.x pandas cartopy