I'm working on coding a folium map and I keep getting this error. I'm new to this and honestly have no idea how to fix this.
import folium
geojson_map = 'https://raw.gituserhubcontent.com/dirkkoolmees/maps-import-export-of-fossil-fuels-/master/custom.geo.json'
world_map = folium.Map(location=[0,0], zoom_start = 1.5, tiles = 'CartoDB positron', min_zoom = 1, max_zoom = 6)
folium.Choropleth(
geo_data = geojson_map,
name = "chloropleth",
data = df_clean,
columns = [df.index, 'value'],
key_on= 'feature.properties.name_sort',
fill_color = 'Reds',
fill_opacity = 0.9,
line_opacity = 0.2,
legend_name = 'GDP'
).add_to(world_map)
world_map
this is the error I receive:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-31-b88f980d229d> in <module>()
13 fill_color = 'Reds',
14 fill_opacity = 0.9,
---> 15 line_opacity = 0.2,
16 #legend_name = 'GDP'
17 ).add_to(world_map)
1 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py in set_index(self, keys, drop, append, inplace, verify_integrity)
4597 # ensure_index_from_sequences would not raise for append=False.
4598 raise ValueError(
-> 4599 f"Length mismatch: Expected {len(self)} rows, "
4600 f"received array of length {len(arrays[-1])}"
4601 )
ValueError: Length mismatch: Expected 154 rows, received array of length 324
Does anybody know how to fix this? Thank you!