<jupyter_start><jupyter_text>Spatial Joins Testing For allowing the kernal for your conda environment to be found by Jupyterhttps://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook  `python -m ipykernel install --user --name myenv --display-name "Python (myenv)"`<jupyter_code>import pandas as pd
import geopandas as gpd
import requests, json
from shapely.geometry import Point
zip_url = 'https://raw.githubusercontent.com/OpenDataDE/State-zip-code-GeoJSON/master/oh_ohio_zip_codes_geo.min.json'
# Return the data
print('Getting Zip Code Shapefile Data...')
response = requests.get(zip_url)
zips = response.json()
jobs = pd.read_csv('./data/jobs.csv')
jobs.head()<jupyter_output><empty_output><jupyter_text>Convert Pandas Dataframe to a GeoDataFrame<jupyter_code># Attempt #1
gdf = gpd.GeoDataFrame(jobs, geometry=gpd.points_from_xy(jobs.lon, jobs.lat))
gdf.crs = {'init': 'epsg:4326'}

# Attempt #2
geom = jobs.apply(lambda x : Point([x['lon'],x['lat']]), axis=1)
gdf = gpd.GeoDataFrame(jobs, geometry=geom)
gdf.crs = {'init': 'epsg:4326'}
gdf.head()
jobdf = gdf.dropna()
jobdf.head()<jupyter_output><empty_output><jupyter_text>Convert GeoJSON to GeoDataFrame<jupyter_code>dfzips = gpd.read_file(zip_url) #Easy enough to just read from URL!
dfzips.crs = {'init': 'epsg:4326'}
dfzips.head()
merged = gpd.sjoin(jobdf, dfzips, how="inner", op="within")
merged.head()
f'Percent Match in Zip Codes: {"{:0.1%}".format(sum(merged.zip == merged.ZCTA5CE10)/len(merged))}'
merged[merged.zip != merged.ZCTA5CE10]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15184243964421856, 'fraction_numerical': 0.019695044472681066, 'mean_word_length': 6.608695652173913, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '127450', 'license': 'MIT', 'n_tokens_mistral': 641, 'n_tokens_neox': 598, 'n_words': 118, 'path': 'spatial_joins.ipynb', 'repo_name': 'elliotpalmer/spatial_joins', 'size': '1574'}