<jupyter_start><jupyter_text>This property data comes with lat and lon coordinates. Here we convert this data to shapefile format so we can easily view/map the points with GIS software<jupyter_code>pd.set_option('max_columns', None)
df = pd.read_excel('./data/portland_properties.xlsx')
df.head(2)
df = df.rename(columns=lambda x: x.lower())
df.head(2)
# create a geometry for each lat lon pair
geoms = df.apply(lambda row: sh.geometry.Point(row['longitude'], row['latitude']), axis=1)
# create a geodataframe to hold the data plus the new geometries
geodf = gpd.GeoDataFrame(df, geometry=geoms)
# discard the now uncessary lat lons
geodf.drop(['longitude', 'latitude'], axis=1, inplace=True)
geodf.head(2)
# tell the geodf what projection this geometry is in
geodf.crs = {'init': 'epsg:4326'}
# write geodf to esri shapefile
geodf.to_file('./data/properties', driver='ESRI Shapefile')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12349726775956284, 'fraction_numerical': 0.009836065573770493, 'mean_word_length': 6.15625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '167232', 'license': 'MIT', 'n_tokens_mistral': 325, 'n_tokens_neox': 314, 'n_words': 95, 'path': 'props_to_shape.ipynb', 'repo_name': 'tadhgfendt/spatial_econometrics', 'size': '915'}