-
-
Save albertum1/8c695ac3621fc2d9fe3709f3f583c615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import geopandas as gpd | |
""" | |
assume train_df, a pandas dataframe, exists with longitude and latitude columns | |
""" | |
# create geopandas dataframe | |
gpd_df = gpd.GeoDataFrame(train_df, | |
geometry = gpd.points_from_xy(train_df['longitude'], train_df['latitude'])) | |
# approximately 10km radius | |
gpd_df['geometry_1km'] = gp_df['geometry'].apply(lambda x: x.buffer(0.1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment