基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill geopandas-point-in-polygon命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Handles reading, populating, and saving .docx files using the python-docx library. Use this skill for any tasks involving template filling or modifying Word documents.
Perform various data analysis on SEC 13-F and obtain some insights of fund activities such as number of holdings, AUM, and change of holdings between two quarters.
This skill includes search capability in 13F, such as fuzzy search a fund information using possibly inaccurate name, or fuzzy search a stock cusip info using its name.
| name | geopandas-point-in-polygon |
| description | How to determine which points fall inside a specific polygon using GeoPandas. |
This skill demonstrates how to filter a set of points (like earthquakes or cities) to find only those that fall within a specific polygon (like a country or tectonic plate) using GeoPandas.
pip install geopandas shapely
When you have a set of points and a polygon, you can use the .within() spatial predicate to filter the points.
import geopandas as gpd
from shapely.geometry import Point
# 1. Load the polygon data
polygons_gdf = gpd.read_file('polygons.geojson')
# 2. Extract the specific polygon you want to test against
# Example: Get the polygon for a specific region
target_polygon = polygons_gdf[polygons_gdf['name'] == 'Target Region'].geometry.unary_union
# 3. Create or load your points data
points_data = [
{'id': 1, 'lat': 34.0, 'lon': -118.2},
{'id': 2, 'lat': 40.7, 'lon': -74.0}
]
# Convert to GeoDataFrame
geometry = [Point(xy['lon'], xy['lat']) for xy in points_data]
points_gdf = gpd.GeoDataFrame(points_data, geometry=geometry, crs="EPSG:4326")
# 4. Perform the spatial filter
# This creates a boolean mask of points that are within the target polygon
points_inside = points_gdf[points_gdf.geometry.within(target_polygon)]
print(f"Found {len(points_inside)} points inside the polygon.")
.unary_union on the filtered polygon GeoDataFrame is useful if the target region consists of multiple polygon geometries (like a multipolygon).