I want to visualize the shapefile data about Iran accidents in googlecolab, but when I try to read it as Geopaandas data frame the plot function is not working correctly, would you please advise me on this issue,
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
gdf = gpd.read_file('/content/accidents.shp',crs=4326)
gdf = gdf.fillna(value=0)
fig, ax = plt.subplots(1, figsize=(20, 20))
ax.axis('off')
ax.set_title('accidents in Iran',
fontdict={'fontsize': '15', 'fontweight' : '3'})
fig = gdf.plot(column='tedad_jarh', cmap='RdYlGn', linewidth=0.5, ax=ax, edgecolor='0.2',legend=True)
the error:
/usr/local/lib/python3.7/dist-packages/matplotlib/axes/_base.py:2450: RuntimeWarning:
overflow encountered in double_scalars
WARNING:matplotlib.text:posx and posy should be finite values
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/ipykernel/pylab/backend_inline.py in show(close, block)
41 display(
42 figure_manager.canvas.figure,
---> 43 metadata=_fetch_figure_metadata(figure_manager.canvas.figure)
44 )
45 finally:
------------------------------------------------------------
/usr/local/lib/python3.7/dist-packages/matplotlib/axis.py in get_tick_space(self)
2193 size = tick.label1.get_size() * 3
2194 if size > 0:
-> 2195 return int(np.floor(length / size))
2196 else:
2197 return 2**31 - 1
**ValueError: cannot convert float NaN to integer**