提问人:Ahmed Said 提问时间:11/17/2023 更新时间:11/17/2023 访问量:10
类型错误:TypeError:输入类型不支持 ufunc 'isnan'
TYPE ERROR: TypeError: ufunc 'isnan' not supported for the input types
问:
进口叶
nyc_neighborhoods_geojson = “file:///C:/Users/ahmed/Downloads/zip_code_040114.geojson”
m = 叶子。Map(location=(40.7128, -74.0060), zoom_start=3, tiles=“cartodb positron”)
# Assuming 'ZIP CODE' is the key for ZIP code in your data
df = df.dropna(subset=['ZIP CODE', 'CONTRIBUTING FACTOR VEHICLE 1'])
# Group by ZIP CODE and find the most common contributing factor for each group
zip_code_data = df.groupby('ZIP CODE')['CONTRIBUTING FACTOR VEHICLE 1'].agg(lambda x:
x.mode().iat[0]).reset_index()
# Use 'feature.properties.ZIPCODE' as the key for ZIP code
folium.Choropleth(
geo_data=nyc_neighborhoods_geojson,
data=zip_code_data,
columns=['ZIP CODE', 'CONTRIBUTING FACTOR VEHICLE 1'],
key_on="feature.properties.ZIPCODE",
).add_to(m)
m.save("footprint.html")`
答: 暂无答案
评论