In [59]:
import numpy as np
import pandas as pd
import geopandas as gpd
import seaborn as sns
import matplotlib.pyplot as plt
import mplleaflet as mpll

In [60]:
accidents = gpd.read_file("donnees/accidents-geobase/accidents_2018.shp")
accidents = accidents[~accidents.geometry.isnull()]
accidents.info()


<class 'geopandas.geodataframe.GeoDataFrame'>
Int64Index: 21381 entries, 0 to 21384
Data columns (total 70 columns):
NO_SEQ_COL    21381 non-null object
JR_SEMN_AC    21381 non-null object
DT_ACCDN      21381 non-null object
CD_MUNCP      21377 non-null float64
NO_CIVIQ_A    8868 non-null float64
SFX_NO_CIV    49 non-null object
BORNE_KM_A    7 non-null float64
RUE_ACCDN     20257 non-null object
TP_REPRR_A    13625 non-null float64
ACCDN_PRES    14465 non-null object
NB_METRE_D    4394 non-null float64
CD_GENRE_A    20662 non-null float64
CD_SIT_PRT    474 non-null float64
CD_ETAT_SU    20519 non-null float64
CD_ECLRM      20572 non-null float64
CD_ENVRN_A    20829 non-null float64
NO_ROUTE      77 non-null float64
CD_CATEG_R    20930 non-null float64
CD_ETAT_CH    5832 non-null float64
CD_ASPCT_R    20729 non-null float64
CD_LOCLN_A    20015 non-null float64
CD_POSI_AC    5397 non-null float64
CD_CONFG_R    19842 non-null float64
CD_ZON_TRA    481 non-null float64
CD_PNT_CDR    14 non-null object
CD_PNT_C_1    6104 non-null object
CD_COND_ME    20461 non-null float64
NB_VEH_IMP    21380 non-null float64
NB_MORTS      21381 non-null int64
NB_BLESSES    21381 non-null int64
NB_BLESS_L    21381 non-null int64
HR_ACCDN      21381 non-null object
AN            21381 non-null int64
NB_VICTIME    21381 non-null int64
GRAVITE       21381 non-null object
REG_ADM       21377 non-null object
MRC           21377 non-null object
nb_automob    21380 non-null float64
nb_camionL    21380 non-null float64
nb_outil_e    21380 non-null float64
nb_tous_au    21380 non-null float64
nb_bicycle    21380 non-null float64
nb_cyclomo    21380 non-null float64
nb_motocyc    21380 non-null float64
nb_taxi       21380 non-null float64
nb_urgence    21380 non-null float64
nb_motonei    21380 non-null float64
nb_VHR        21380 non-null float64
nb_autres_    21380 non-null float64
nb_veh_non    21380 non-null float64
NB_DECES_P    21381 non-null int64
NB_BLESS_1    21381 non-null int64
NB_VICTI_1    21381 non-null int64
NB_DECES_M    21381 non-null int64
NB_BLESS_2    21381 non-null int64
NB_VICTI_2    21381 non-null int64
NB_DECES_V    21381 non-null int64
NB_BLESS_3    21381 non-null int64
NB_VICTI_3    21381 non-null int64
VITESSE_AU    13034 non-null float64
LOC_X         21381 non-null float64
LOC_Y         21381 non-null float64
LOC_COTE_Q    21381 non-null object
LOC_COTE_P    21381 non-null int64
LOC_DETACH    21381 non-null object
LOC_IMPREC    21381 non-null object
LOC_LONG      21381 non-null float64
LOC_LAT       21381 non-null float64
MOIS          21381 non-null object
geometry      21381 non-null geometry
dtypes: float64(38), geometry(1), int64(15), object(16)
memory usage: 11.6+ MB

In [61]:
sns.jointplot(x="LOC_X", y="LOC_Y", data=accidents)


Out[61]:
<seaborn.axisgrid.JointGrid at 0x7fdce910ecc0>

In [62]:
#accidents#
fig, ax = plt.subplots(1, figsize=(6, 6))
wgsAccidents = gpd.read_file("donnees/accidents-geobase/accidents0.shp").to_crs(epsg = 4326)
wgsAccidents.plot(ax=ax)
mpll.display(fig=fig)


/usr/local/lib/python3.6/dist-packages/IPython/core/display.py:694: UserWarning: Consider using IPython.display.IFrame instead
  warnings.warn("Consider using IPython.display.IFrame instead")
Out[62]: