Весенний проект по курсу «Наука о данных», Совместный бакалавриат ВШЭ-РЭШ, 2018-19 учебный год.
Автор работы: Даниил Бушуев.
Будем анализировать случаи смертей мигрантов
import pandas as pd
data = pd.read_csv('MissingMigrants-Global-2019-04-12T02-13-32.csv')
data.shape
(5343, 20)
data.head()
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | Number of Males | Number of Children | Cause of Death | Location Description | Information Source | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | 1.0 | NaN | Fall from vehicle | Road towards Comunidad Estación La Colorada, n... | Zacatecas Online | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | NaN | NaN | Presumed drowning | Off the coast of Al-Hoceima, Morocco (Alboran ... | Association Marocaine des Droits Humains - Sec... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | NaN | 1 | 12.0 | NaN | 1.0 | NaN | Hypothermia | After disembarkation in Port of Tarifa, Cádiz,... | Europa Sur, ABC | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | 14.0 | NaN | 1.0 | NaN | Fall from vehicle | Along Udovo-Demir Kapija road, near Vodisirska... | North Macedonia Ministry of Interior via IOM S... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | 1.0 | NaN | Fall into a mountain crevice | Forest area north of Javornik, north-west of P... | Police Directorate of Lika Senj, HGSS (Croatia... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 |
import matplotlib.pyplot as plt
data.hist()
plt.show()
plt.rcParams["figure.figsize"] = [10, 10]
data['Number Dead'].hist()
plt.show()
data['Number Dead'].max()
750.0
750 человек погибло! Ничего себе! Давайте почитаем больше об этом
data[data['Number Dead'] == 750]['URL']
4987 http://bit.ly/1Oa2qYi Name: URL, dtype: object
data[data['Number Dead'] == 750]
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | Number of Males | Number of Children | Cause of Death | Location Description | Information Source | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4987 | 40345 | Mediterranean | April 18, 2015 | 2015 | Apr | 750.0 | 272.0 | 1,022 | 28.0 | NaN | NaN | NaN | Drowning | 120 miles south of Lampedusa, 110 kilometers n... | ICRC | 35.030000000000, 14.677700000000 | Central Mediterranean | http://bit.ly/1Oa2qYi | Uncategorized | 4 |
Займемся подготовкой данных для визуализации. Сначала нам надо разделить долготу и широту в разные переменные.
data['latitude'], data['longitude'] = data['Location Coordinates'].str.split(',', 1).str
data.head()
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Cause of Death | Location Description | Information Source | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | ... | Fall from vehicle | Road towards Comunidad Estación La Colorada, n... | Zacatecas Online | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 | 23.260560931726 | -102.337369154380 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | ... | Presumed drowning | Off the coast of Al-Hoceima, Morocco (Alboran ... | Association Marocaine des Droits Humains - Sec... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 | 35.358181389497 | -3.963637678454 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | NaN | 1 | 12.0 | NaN | ... | Hypothermia | After disembarkation in Port of Tarifa, Cádiz,... | Europa Sur, ABC | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 | 35.980298764742 | -5.773669680016 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | 14.0 | NaN | ... | Fall from vehicle | Along Udovo-Demir Kapija road, near Vodisirska... | North Macedonia Ministry of Interior via IOM S... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 | 41.420003176858 | 22.222123150364 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Fall into a mountain crevice | Forest area north of Javornik, north-west of P... | Police Directorate of Lika Senj, HGSS (Croatia... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 | 44.983703900000 | 15.476410700000 |
5 rows × 22 columns
data['latitude'] = pd.to_numeric(data['latitude'])
data['longitude'] = pd.to_numeric(data['longitude'])
Найдем и избавимся от пропусков в важных для нас данных
data[data['latitude'].isnull() == True]
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Cause of Death | Location Description | Information Source | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2453 | 51450 | Sub-Saharan Africa | June 27, 2017 | 2017 | Jun | 1.0 | NaN | 1 | NaN | 1.0 | ... | Sickness and lack of access to medicines | Sahara Desert, Niger | Mixed Migration Monitoring Mechanism (4mi) | NaN | NaN | http://www.mixedmigration.org/4mi/ | Western Europe | 2 | NaN | NaN |
1 rows × 22 columns
data = data.drop(data[data['latitude'].isnull() == True].index)
data = data.reset_index(drop = True)
data
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Cause of Death | Location Description | Information Source | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | ... | Fall from vehicle | Road towards Comunidad Estación La Colorada, n... | Zacatecas Online | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 | 23.260561 | -102.337369 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | NaN | 1 | NaN | NaN | ... | Presumed drowning | Off the coast of Al-Hoceima, Morocco (Alboran ... | Association Marocaine des Droits Humains - Sec... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 | 35.358181 | -3.963638 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | NaN | 1 | 12.0 | NaN | ... | Hypothermia | After disembarkation in Port of Tarifa, Cádiz,... | Europa Sur, ABC | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 | 35.980299 | -5.773670 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | 14.0 | NaN | ... | Fall from vehicle | Along Udovo-Demir Kapija road, near Vodisirska... | North Macedonia Ministry of Interior via IOM S... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 | 41.420003 | 22.222123 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Fall into a mountain crevice | Forest area north of Javornik, north-west of P... | Police Directorate of Lika Senj, HGSS (Croatia... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 | 44.983704 | 15.476411 |
5 | 51599 | Caribbean | March 31, 2019 | 2019 | Mar | 17.0 | 2.0 | 19 | 14.0 | NaN | ... | Drowning | Off the coast of West Caicos, Turks and Caicos... | Miami Herald, Royal Turks and Caicos Islands P... | 21.544304856421, -72.464247663854 | NaN | https://hrld.us/2CLDhC8, http://bit.ly/2U8gMlj... | Caribbean | 5 | 21.544305 | -72.464248 |
6 | 51591 | Mediterranean | March 28, 2019 | 2019 | Mar | NaN | 2.0 | 2 | 36.0 | NaN | ... | Presumed drowning | Off the coast of Chios, Greece | Hellenic Coast Guard via IOM Greece | 38.362368696592, 26.172509473654 | Eastern Mediterranean | NaN | Uncategorized | 5 | 38.362369 | 26.172509 |
7 | 51588 | Mediterranean | March 26, 2019 | 2019 | Mar | 4.0 | NaN | 4 | 11.0 | 3.0 | ... | Presumed drowning | Off the coast of Ayvacık district, Çanakkale p... | Turkish Coast Guard via IOM Turkey | 39.441975591614, 26.378816195919 | Eastern Mediterranean | http://bit.ly/2YmiPAN | Uncategorized | 5 | 39.441976 | 26.378816 |
8 | 51589 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Presumed drowning | Body recovered on Playa del Tarajal, Ceuta, Sp... | Ceuta al día, El Pueblo de Ceuta | 35.871901875921, -5.343037665842 | Western Mediterranean | http://bit.ly/2uyj7qO, http://bit.ly/2uwj5zC | Uncategorized | 3 | 35.871902 | -5.343038 |
9 | 51590 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Presumed drowning | Body recovered on beach near Tetouan, Morocco ... | El Pueblo de Ceuta | 35.635115912988, -5.275650103548 | Western Mediterranean | http://bit.ly/2uwj5zC | Uncategorized | 1 | 35.635116 | -5.275650 |
10 | 51587 | Central America | March 25, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Fall from train | Train tracks in Teacalco, Tlaxcala, Mexico | Megalópolis, Línea de contraste | 19.334475177429, -98.069823987538 | NaN | http://bit.ly/2uvDIvH, http://bit.ly/2TXAFLS | Central America | 3 | 19.334475 | -98.069824 |
11 | 51596 | US-Mexico Border | March 24, 2019 | 2019 | Mar | 2.0 | NaN | 2 | NaN | 1.0 | ... | Vehicle Accident | Road near Laredo, Webb County, Texas, USA | El Mercurio, Bello Ecuador | 27.403037241929, -99.478838604955 | NaN | http://bit.ly/2FO7KA3, http://bit.ly/2TSR2o3 | Northern America | 3 | 27.403037 | -99.478839 |
12 | 51580 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 |
13 | 51581 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 |
14 | 51585 | Southeast Asia | March 23, 2019 | 2019 | Mar | 8.0 | 2.0 | 10 | NaN | 1.0 | ... | Vehicle Accident | Sa Setthi intersection in Tambon Ban Mai, Tha ... | The Nation, Vietnam+ | 13.865704814542, 99.587248723929 | NaN | http://bit.ly/2YqrMsT, http://bit.ly/2TzbavA | South-eastern Asia | 3 | 13.865705 | 99.587249 |
15 | 51586 | Mediterranean | March 23, 2019 | 2019 | Mar | 4.0 | 4.0 | 8 | NaN | 3.0 | ... | Presumed drowning | Off the coast of Sfax, Tunisia | Shems FM, Tunisie Numérique, Kapitalis | 35.317034468315, 11.078928258810 | Central Mediterranean | http://bit.ly/2U1K4C4, http://bit.ly/2HJW70B, ... | Uncategorized | 3 | 35.317034 | 11.078928 |
16 | 51595 | Mediterranean | March 23, 2019 | 2019 | Mar | NaN | 41.0 | 41 | NaN | NaN | ... | Presumed drowning | Off the coast of Sabratha, Libya | IOM Italy, Mediterranea Rescue | 32.837325915454, 12.432737422718 | Central Mediterranean | http://bit.ly/2CEoDMW, http://bit.ly/2YrtWZd, ... | Uncategorized | 4 | 32.837326 | 12.432737 |
17 | 51594 | Mediterranean | March 22, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | 1.0 | ... | Presumed drowning | Body recovered on Playa de Horcas Coloradas, n... | El Faro de Melilla, Europa Press | 35.324581077512, -2.955065558274 | Western Mediterranean | http://bit.ly/2OFEf7r, http://bit.ly/2TQg07y | Uncategorized | 3 | 35.324581 | -2.955066 |
18 | 51578 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 |
19 | 51579 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 |
20 | 51584 | Central America | March 20, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Violence | Town of Nueva Patria (Santo Domingo), Municipa... | Notiver | 24.057148900000, -105.457669800000 | NaN | https://bit.ly/2JFeB4c, https://bit.ly/2Wqx8lZ | Central America | 1 | 24.057149 | -105.457670 |
21 | 51548 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 3.0 | 4 | 15.0 | NaN | ... | Presumed drowning | Between Sabratha and Surman, Libya | IOM Libya | 32.816243467052, 12.530851413107 | Central Mediterranean | http://bit.ly/2ue4qZx, https://bit.ly/2TR74nh,... | Uncategorized | 3 | 32.816243 | 12.530851 |
22 | 51593 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | 1.0 | ... | Presumed drowning | Body recovered off the coast of Aguadú, Melill... | La Vanguardia, El Faro de Melilla | 35.320534947419, -2.951115676707 | Western Mediterranean | http://bit.ly/2uCBhaL, http://bit.ly/2YHKg8k | Uncategorized | 3 | 35.320535 | -2.951116 |
23 | 51546 | Mediterranean | March 18, 2019 | 2019 | Mar | 3.0 | NaN | 3 | 52.0 | NaN | ... | Presumed drowning | Unspecified location in the Alboran Sea, off t... | Caminando Fronteras, Huffington Post Maghreb | 35.267895220573, -2.799562392362 | Western Mediterranean | http://bit.ly/2TVZas5, http://bit.ly/2HHj7MI | Uncategorized | 4 | 35.267895 | -2.799562 |
24 | 51545 | Central America | March 17, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Hit by train | Train tracks near Avenida Vergel, sector centr... | Milenio | 25.563914159609, -103.492111622910 | NaN | http://bit.ly/2Y8xOOy | Central America | 1 | 25.563914 | -103.492112 |
25 | 51547 | North Africa | March 17, 2019 | 2019 | Mar | NaN | 19.0 | 19 | 1.0 | NaN | ... | Presumed drowning | Off the coast of Sidi Warzeg, Sidi Ifni, near ... | Hams News | 29.425766218075, -10.453333285156 | Western African | https://bit.ly/2TiLeUS, https://twitter.com/al... | Uncategorized | 1 | 29.425766 | -10.453333 |
26 | 51577 | US-Mexico Border | March 15, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 32.331803200000, -112.524509300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.331803 | -112.524509 |
27 | 51544 | Mediterranean | March 14, 2019 | 2019 | Mar | 1.0 | 44.0 | 45 | 22.0 | 3.0 | ... | Drowning | Unspecified location in the Alboran Sea, off t... | Caminando Fronteras, Alarm Phone, AP, Associat... | 35.298258842764, -2.688431354400 | Western Mediterranean | http://bit.ly/2O7CPT5, http://bit.ly/2TDZT1O, ... | Uncategorized | 4 | 35.298259 | -2.688431 |
28 | 51576 | US-Mexico Border | March 13, 2019 | 2019 | Mar | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County jurisdiction, Arizona, USA | Pima County Office of the Medical Examiner | 31.794415600000, -112.446447300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 31.794416 | -112.446447 |
29 | 51534 | Caribbean | March 11, 2019 | 2019 | Mar | 1.0 | NaN | 1 | 15.0 | NaN | ... | Presumed drowning | Near Isla Catalina, Dominican Republic | Listin Diario, Acento | 18.232326183657, -69.057353261657 | NaN | http://bit.ly/2UArflI, http://bit.ly/2VVIpuu | Caribbean | 3 | 18.232326 | -69.057353 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
5312 | 39230 | Mediterranean | February 27, 2014 | 2014 | Feb | 7.0 | NaN | 7 | NaN | NaN | ... | Drowning | Libyan Coast | Libya herald | 33.159700000000, 15.183100000000 | Central Mediterranean | http://bit.ly/1lvR4Ka | Uncategorized | 1 | 33.159700 | 15.183100 |
5313 | 39229 | Horn of Africa | February 26, 2014 | 2014 | Feb | 11.0 | 6.0 | 17 | 0.0 | NaN | ... | Drowning | Gulf of Aden (left from Djibouti) | IOM | 20.280200000000, 38.512600000000 | NaN | http://bit.ly/1pTfmSe | Uncategorized | 4 | 20.280200 | 38.512600 |
5314 | 39379 | South Asia | February 26, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 0.0 | NaN | ... | Shot | India | Daily Star | 25.184100000000, 88.905500000000 | NaN | http://bit.ly/1vs5kco | Southern Asia | 1 | 25.184100 | 88.905500 |
5315 | 39271 | US-Mexico Border | February 25, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5316 | 39270 | US-Mexico Border | February 21, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5317 | 39196 | Caribbean | February 20, 2014 | 2014 | Feb | 8.0 | 0.0 | 8 | 0.0 | NaN | ... | Drowning | Dominican Republic | AP | 18.450500000000, -67.796600000000 | NaN | http://bit.ly/1sWDTeE | Caribbean | 1 | 18.450500 | -67.796600 |
5318 | 39269 | US-Mexico Border | February 20, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5319 | 39211 | US-Mexico Border | February 18, 2014 | 2014 | Feb | 1.0 | NaN | 1 | 2.0 | NaN | ... | Shot | California-Mexico border near San Diego | CNN | 32.554300000000, -117.052000000000 | Central America to US | http://cnn.it/1jGgOUo | Northern America | 1 | 32.554300 | -117.052000 |
5320 | 39228 | Mediterranean | February 17, 2014 | 2014 | Feb | 2.0 | 0.0 | 2 | 121.0 | NaN | ... | Unknown | Italy waters | Malta Today | 34.564500000000, 15.886200000000 | Central Mediterranean | http://bit.ly/V7JIqE | Uncategorized | 1 | 34.564500 | 15.886200 |
5321 | 39268 | US-Mexico Border | February 17, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5322 | 39266 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5323 | 39267 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5324 | 39265 | US-Mexico Border | February 11, 2014 | 2014 | Feb | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5325 | 39404 | Mediterranean | February 06, 2014 | 2014 | Feb | 15.0 | 0.0 | 15 | 0.0 | NaN | ... | Shot | Ceuta waters | L'Espresso | 35.879300000000, -5.364070000000 | Western Mediterranean | http://bit.ly/U4b8wu, http://bit.ly/2kyBK8g, h... | Uncategorized | 1 | 35.879300 | -5.364070 |
5326 | 39195 | Caribbean | January 30, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Drowning | Off the coast of Fort Lauderdale, Florida | Local10.com | 26.116000000000, -80.046400000000 | NaN | http://bit.ly/1zU2LSq | Caribbean | 1 | 26.116000 | -80.046400 |
5327 | 39373 | Europe | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | Vehicle Accident | France - Calais | Calais Migrant Solidarity | 50.935500000000, 1.878660000000 | Calais to United Kingdom | http://bit.ly/1icTIF9 | Western Europe | 4 | 50.935500 | 1.878660 |
5328 | 39263 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5329 | 39264 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5330 | 39262 | US-Mexico Border | January 28, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5331 | 39208 | US-Mexico Border | January 25, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5332 | 39260 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5333 | 39261 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5334 | 39259 | US-Mexico Border | January 22, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5335 | 39403 | Mediterranean | January 19, 2014 | 2014 | Jan | 12.0 | NaN | 12 | NaN | 9.0 | ... | Drowning | Waters near Greece while being towed back to T... | European Council on Refugees and Exiles | 37.283200000000, 27.158200000000 | Eastern Mediterranean | http://bit.ly/2aMCwfg | Uncategorized | 1 | 37.283200 | 27.158200 |
5336 | 39258 | US-Mexico Border | January 17, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Shot | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5337 | 39207 | US-Mexico Border | January 16, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Shot | near Douglas, Arizona | Ministry of Foreign Affairs Mexico | 31.344700000000, -109.545000000000 | Central America to US | http://bit.ly/1qfIw00 | Northern America | 5 | 31.344700 | -109.545000 |
5338 | 39368 | Europe | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | Hyperthermia | Border between Russia and Estonia | EUBusiness (Agence France-Presse) | 59.155100000000, 27.858600000000 | NaN | http://bit.ly/1rTFTjR | Northern Europe | 1 | 59.155100 | 27.858600 |
5339 | 39257 | US-Mexico Border | January 14, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5340 | 39256 | US-Mexico Border | January 12, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Pima County Office of the Medical Examiner | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 |
5341 | 39206 | US-Mexico Border | January 06, 2014 | 2014 | Jan | 1.0 | NaN | 1 | NaN | NaN | ... | Unknown (skeletal remains) | Pima County | Humane Borders Arizona Open GIS Initiative | 32.058118300000, -111.623576100000 | Central America to US | http://humaneborders.info/ | Northern America | 5 | 32.058118 | -111.623576 |
5342 rows × 22 columns
Начинаем работать с визуализацией
import gmaps
gmaps.configure(api_key='xxx') #здесь надо вставить ключ доступа к API Google Maps
#если ключа у вас нет, то результаты в виде картинке можно найти в приложенной папке
#может вылететь ошибка 404 в терминале
#решение - https://github.com/pbugnion/gmaps/issues/79
locations = data[['latitude', 'longitude']]
fig = gmaps.figure(map_type='HYBRID')
heatmap_layer = gmaps.heatmap_layer(locations)
fig.add_layer(heatmap_layer)
fig
A Jupyter Widget
heatmap_layer.max_intensity = 5 #карта сверху обновилась
heatmap_layer.point_radius = 5
К сожалению, такая визуализация не отражает степень происшествий. Например, на границе США и Мексики могут происходить единичные вылазки, когда в Европе тонут корабли с сотнями мигрантов. Давайте поработаем с магнитудой.
from sklearn import preprocessing
data['Number Dead'] = pd.to_numeric(data['Number Dead'])
data['Number Dead'] = data['Number Dead'].fillna(0)
data['Minimum Estimated Number of Missing'] = pd.to_numeric(data['Minimum Estimated Number of Missing'])
data['Minimum Estimated Number of Missing'] = data['Minimum Estimated Number of Missing'].fillna(0)
scaler = preprocessing.MaxAbsScaler()
scaledDead = scaler.fit_transform(data['Number Dead'].values.reshape(-1, 1))
scaledMissing = scaler.fit_transform(data['Minimum Estimated Number of Missing'].values.reshape(-1, 1))
data['scaledDead'] = pd.DataFrame(scaledDead)
data['scaledMissing'] = pd.DataFrame(scaledMissing)
data['magnitude'] = data['scaledDead'] + 0.5 * data['scaledMissing']
data
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | scaledDead | scaledMissing | magnitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 | 23.260561 | -102.337369 | 0.001333 | 0.000000 | 0.001333 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 | 35.358181 | -3.963638 | 0.001333 | 0.000000 | 0.001333 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | 12.0 | NaN | ... | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 | 35.980299 | -5.773670 | 0.001333 | 0.000000 | 0.001333 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 14.0 | NaN | ... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 | 41.420003 | 22.222123 | 0.001333 | 0.000000 | 0.001333 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 | 44.983704 | 15.476411 | 0.001333 | 0.000000 | 0.001333 |
5 | 51599 | Caribbean | March 31, 2019 | 2019 | Mar | 17.0 | 2.0 | 19 | 14.0 | NaN | ... | 21.544304856421, -72.464247663854 | NaN | https://hrld.us/2CLDhC8, http://bit.ly/2U8gMlj... | Caribbean | 5 | 21.544305 | -72.464248 | 0.022667 | 0.002667 | 0.024000 |
6 | 51591 | Mediterranean | March 28, 2019 | 2019 | Mar | 0.0 | 2.0 | 2 | 36.0 | NaN | ... | 38.362368696592, 26.172509473654 | Eastern Mediterranean | NaN | Uncategorized | 5 | 38.362369 | 26.172509 | 0.000000 | 0.002667 | 0.001333 |
7 | 51588 | Mediterranean | March 26, 2019 | 2019 | Mar | 4.0 | 0.0 | 4 | 11.0 | 3.0 | ... | 39.441975591614, 26.378816195919 | Eastern Mediterranean | http://bit.ly/2YmiPAN | Uncategorized | 5 | 39.441976 | 26.378816 | 0.005333 | 0.000000 | 0.005333 |
8 | 51589 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.871901875921, -5.343037665842 | Western Mediterranean | http://bit.ly/2uyj7qO, http://bit.ly/2uwj5zC | Uncategorized | 3 | 35.871902 | -5.343038 | 0.001333 | 0.000000 | 0.001333 |
9 | 51590 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.635115912988, -5.275650103548 | Western Mediterranean | http://bit.ly/2uwj5zC | Uncategorized | 1 | 35.635116 | -5.275650 | 0.001333 | 0.000000 | 0.001333 |
10 | 51587 | Central America | March 25, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 19.334475177429, -98.069823987538 | NaN | http://bit.ly/2uvDIvH, http://bit.ly/2TXAFLS | Central America | 3 | 19.334475 | -98.069824 | 0.001333 | 0.000000 | 0.001333 |
11 | 51596 | US-Mexico Border | March 24, 2019 | 2019 | Mar | 2.0 | 0.0 | 2 | NaN | 1.0 | ... | 27.403037241929, -99.478838604955 | NaN | http://bit.ly/2FO7KA3, http://bit.ly/2TSR2o3 | Northern America | 3 | 27.403037 | -99.478839 | 0.002667 | 0.000000 | 0.002667 |
12 | 51580 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
13 | 51581 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
14 | 51585 | Southeast Asia | March 23, 2019 | 2019 | Mar | 8.0 | 2.0 | 10 | NaN | 1.0 | ... | 13.865704814542, 99.587248723929 | NaN | http://bit.ly/2YqrMsT, http://bit.ly/2TzbavA | South-eastern Asia | 3 | 13.865705 | 99.587249 | 0.010667 | 0.002667 | 0.012000 |
15 | 51586 | Mediterranean | March 23, 2019 | 2019 | Mar | 4.0 | 4.0 | 8 | NaN | 3.0 | ... | 35.317034468315, 11.078928258810 | Central Mediterranean | http://bit.ly/2U1K4C4, http://bit.ly/2HJW70B, ... | Uncategorized | 3 | 35.317034 | 11.078928 | 0.005333 | 0.005333 | 0.008000 |
16 | 51595 | Mediterranean | March 23, 2019 | 2019 | Mar | 0.0 | 41.0 | 41 | NaN | NaN | ... | 32.837325915454, 12.432737422718 | Central Mediterranean | http://bit.ly/2CEoDMW, http://bit.ly/2YrtWZd, ... | Uncategorized | 4 | 32.837326 | 12.432737 | 0.000000 | 0.054667 | 0.027333 |
17 | 51594 | Mediterranean | March 22, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.324581077512, -2.955065558274 | Western Mediterranean | http://bit.ly/2OFEf7r, http://bit.ly/2TQg07y | Uncategorized | 3 | 35.324581 | -2.955066 | 0.001333 | 0.000000 | 0.001333 |
18 | 51578 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
19 | 51579 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
20 | 51584 | Central America | March 20, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 24.057148900000, -105.457669800000 | NaN | https://bit.ly/2JFeB4c, https://bit.ly/2Wqx8lZ | Central America | 1 | 24.057149 | -105.457670 | 0.001333 | 0.000000 | 0.001333 |
21 | 51548 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 3.0 | 4 | 15.0 | NaN | ... | 32.816243467052, 12.530851413107 | Central Mediterranean | http://bit.ly/2ue4qZx, https://bit.ly/2TR74nh,... | Uncategorized | 3 | 32.816243 | 12.530851 | 0.001333 | 0.004000 | 0.003333 |
22 | 51593 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.320534947419, -2.951115676707 | Western Mediterranean | http://bit.ly/2uCBhaL, http://bit.ly/2YHKg8k | Uncategorized | 3 | 35.320535 | -2.951116 | 0.001333 | 0.000000 | 0.001333 |
23 | 51546 | Mediterranean | March 18, 2019 | 2019 | Mar | 3.0 | 0.0 | 3 | 52.0 | NaN | ... | 35.267895220573, -2.799562392362 | Western Mediterranean | http://bit.ly/2TVZas5, http://bit.ly/2HHj7MI | Uncategorized | 4 | 35.267895 | -2.799562 | 0.004000 | 0.000000 | 0.004000 |
24 | 51545 | Central America | March 17, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 25.563914159609, -103.492111622910 | NaN | http://bit.ly/2Y8xOOy | Central America | 1 | 25.563914 | -103.492112 | 0.001333 | 0.000000 | 0.001333 |
25 | 51547 | North Africa | March 17, 2019 | 2019 | Mar | 0.0 | 19.0 | 19 | 1.0 | NaN | ... | 29.425766218075, -10.453333285156 | Western African | https://bit.ly/2TiLeUS, https://twitter.com/al... | Uncategorized | 1 | 29.425766 | -10.453333 | 0.000000 | 0.025333 | 0.012667 |
26 | 51577 | US-Mexico Border | March 15, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.331803200000, -112.524509300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.331803 | -112.524509 | 0.001333 | 0.000000 | 0.001333 |
27 | 51544 | Mediterranean | March 14, 2019 | 2019 | Mar | 1.0 | 44.0 | 45 | 22.0 | 3.0 | ... | 35.298258842764, -2.688431354400 | Western Mediterranean | http://bit.ly/2O7CPT5, http://bit.ly/2TDZT1O, ... | Uncategorized | 4 | 35.298259 | -2.688431 | 0.001333 | 0.058667 | 0.030667 |
28 | 51576 | US-Mexico Border | March 13, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.794415600000, -112.446447300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 31.794416 | -112.446447 | 0.001333 | 0.000000 | 0.001333 |
29 | 51534 | Caribbean | March 11, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 15.0 | NaN | ... | 18.232326183657, -69.057353261657 | NaN | http://bit.ly/2UArflI, http://bit.ly/2VVIpuu | Caribbean | 3 | 18.232326 | -69.057353 | 0.001333 | 0.000000 | 0.001333 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
5312 | 39230 | Mediterranean | February 27, 2014 | 2014 | Feb | 7.0 | 0.0 | 7 | NaN | NaN | ... | 33.159700000000, 15.183100000000 | Central Mediterranean | http://bit.ly/1lvR4Ka | Uncategorized | 1 | 33.159700 | 15.183100 | 0.009333 | 0.000000 | 0.009333 |
5313 | 39229 | Horn of Africa | February 26, 2014 | 2014 | Feb | 11.0 | 6.0 | 17 | 0.0 | NaN | ... | 20.280200000000, 38.512600000000 | NaN | http://bit.ly/1pTfmSe | Uncategorized | 4 | 20.280200 | 38.512600 | 0.014667 | 0.008000 | 0.018667 |
5314 | 39379 | South Asia | February 26, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 0.0 | NaN | ... | 25.184100000000, 88.905500000000 | NaN | http://bit.ly/1vs5kco | Southern Asia | 1 | 25.184100 | 88.905500 | 0.001333 | 0.000000 | 0.001333 |
5315 | 39271 | US-Mexico Border | February 25, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5316 | 39270 | US-Mexico Border | February 21, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5317 | 39196 | Caribbean | February 20, 2014 | 2014 | Feb | 8.0 | 0.0 | 8 | 0.0 | NaN | ... | 18.450500000000, -67.796600000000 | NaN | http://bit.ly/1sWDTeE | Caribbean | 1 | 18.450500 | -67.796600 | 0.010667 | 0.000000 | 0.010667 |
5318 | 39269 | US-Mexico Border | February 20, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5319 | 39211 | US-Mexico Border | February 18, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 32.554300000000, -117.052000000000 | Central America to US | http://cnn.it/1jGgOUo | Northern America | 1 | 32.554300 | -117.052000 | 0.001333 | 0.000000 | 0.001333 |
5320 | 39228 | Mediterranean | February 17, 2014 | 2014 | Feb | 2.0 | 0.0 | 2 | 121.0 | NaN | ... | 34.564500000000, 15.886200000000 | Central Mediterranean | http://bit.ly/V7JIqE | Uncategorized | 1 | 34.564500 | 15.886200 | 0.002667 | 0.000000 | 0.002667 |
5321 | 39268 | US-Mexico Border | February 17, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5322 | 39266 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5323 | 39267 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5324 | 39265 | US-Mexico Border | February 11, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5325 | 39404 | Mediterranean | February 06, 2014 | 2014 | Feb | 15.0 | 0.0 | 15 | 0.0 | NaN | ... | 35.879300000000, -5.364070000000 | Western Mediterranean | http://bit.ly/U4b8wu, http://bit.ly/2kyBK8g, h... | Uncategorized | 1 | 35.879300 | -5.364070 | 0.020000 | 0.000000 | 0.020000 |
5326 | 39195 | Caribbean | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 26.116000000000, -80.046400000000 | NaN | http://bit.ly/1zU2LSq | Caribbean | 1 | 26.116000 | -80.046400 | 0.001333 | 0.000000 | 0.001333 |
5327 | 39373 | Europe | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 50.935500000000, 1.878660000000 | Calais to United Kingdom | http://bit.ly/1icTIF9 | Western Europe | 4 | 50.935500 | 1.878660 | 0.001333 | 0.000000 | 0.001333 |
5328 | 39263 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5329 | 39264 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5330 | 39262 | US-Mexico Border | January 28, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5331 | 39208 | US-Mexico Border | January 25, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5332 | 39260 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5333 | 39261 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5334 | 39259 | US-Mexico Border | January 22, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5335 | 39403 | Mediterranean | January 19, 2014 | 2014 | Jan | 12.0 | 0.0 | 12 | NaN | 9.0 | ... | 37.283200000000, 27.158200000000 | Eastern Mediterranean | http://bit.ly/2aMCwfg | Uncategorized | 1 | 37.283200 | 27.158200 | 0.016000 | 0.000000 | 0.016000 |
5336 | 39258 | US-Mexico Border | January 17, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5337 | 39207 | US-Mexico Border | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.344700000000, -109.545000000000 | Central America to US | http://bit.ly/1qfIw00 | Northern America | 5 | 31.344700 | -109.545000 | 0.001333 | 0.000000 | 0.001333 |
5338 | 39368 | Europe | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 59.155100000000, 27.858600000000 | NaN | http://bit.ly/1rTFTjR | Northern Europe | 1 | 59.155100 | 27.858600 | 0.001333 | 0.000000 | 0.001333 |
5339 | 39257 | US-Mexico Border | January 14, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5340 | 39256 | US-Mexico Border | January 12, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5341 | 39206 | US-Mexico Border | January 06, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | http://humaneborders.info/ | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5342 rows × 25 columns
figWeighted = gmaps.figure()
figWeighted = gmaps.figure(map_type='HYBRID')
heatmapLayerWeighted = gmaps.heatmap_layer(locations, weights = data['magnitude'], max_intensity=1, point_radius=5)
figWeighted.add_layer(heatmapLayerWeighted)
Теперь на карте мы не видим единичные случаи. Больше всего выделяются места где поистине происходит кризис с большим количеством жертв.
figWeighted
A Jupyter Widget
На случай, если ключа у вас не нашлось, то вот результат выполнения скрипта на карте
Как видно на карте выше, больше всего проблем происходит на границах и в Средиземном море. Давайте посмотрим как описание происшествия влияет на его магнитуду. Для начала подготовим данные.
data.columns
Index(['Web ID', 'Region of Incident', 'Reported Date', 'Reported Year', 'Reported Month', 'Number Dead', 'Minimum Estimated Number of Missing', 'Total Dead and Missing', 'Number of Survivors', 'Number of Females', 'Number of Males', 'Number of Children', 'Cause of Death', 'Location Description', 'Information Source', 'Location Coordinates', 'Migration Route', 'URL', 'UNSD Geographical Grouping', 'Source Quality', 'latitude', 'longitude', 'scaledDead', 'scaledMissing', 'magnitude'], dtype='object')
data['Location Description'].head()
0 Road towards Comunidad Estación La Colorada, n... 1 Off the coast of Al-Hoceima, Morocco (Alboran ... 2 After disembarkation in Port of Tarifa, Cádiz,... 3 Along Udovo-Demir Kapija road, near Vodisirska... 4 Forest area north of Javornik, north-west of P... Name: Location Description, dtype: object
dataML = data.copy()
dataML.shape
(5342, 25)
dataML
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | scaledDead | scaledMissing | magnitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 | 23.260561 | -102.337369 | 0.001333 | 0.000000 | 0.001333 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 | 35.358181 | -3.963638 | 0.001333 | 0.000000 | 0.001333 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | 12.0 | NaN | ... | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 | 35.980299 | -5.773670 | 0.001333 | 0.000000 | 0.001333 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 14.0 | NaN | ... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 | 41.420003 | 22.222123 | 0.001333 | 0.000000 | 0.001333 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 | 44.983704 | 15.476411 | 0.001333 | 0.000000 | 0.001333 |
5 | 51599 | Caribbean | March 31, 2019 | 2019 | Mar | 17.0 | 2.0 | 19 | 14.0 | NaN | ... | 21.544304856421, -72.464247663854 | NaN | https://hrld.us/2CLDhC8, http://bit.ly/2U8gMlj... | Caribbean | 5 | 21.544305 | -72.464248 | 0.022667 | 0.002667 | 0.024000 |
6 | 51591 | Mediterranean | March 28, 2019 | 2019 | Mar | 0.0 | 2.0 | 2 | 36.0 | NaN | ... | 38.362368696592, 26.172509473654 | Eastern Mediterranean | NaN | Uncategorized | 5 | 38.362369 | 26.172509 | 0.000000 | 0.002667 | 0.001333 |
7 | 51588 | Mediterranean | March 26, 2019 | 2019 | Mar | 4.0 | 0.0 | 4 | 11.0 | 3.0 | ... | 39.441975591614, 26.378816195919 | Eastern Mediterranean | http://bit.ly/2YmiPAN | Uncategorized | 5 | 39.441976 | 26.378816 | 0.005333 | 0.000000 | 0.005333 |
8 | 51589 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.871901875921, -5.343037665842 | Western Mediterranean | http://bit.ly/2uyj7qO, http://bit.ly/2uwj5zC | Uncategorized | 3 | 35.871902 | -5.343038 | 0.001333 | 0.000000 | 0.001333 |
9 | 51590 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.635115912988, -5.275650103548 | Western Mediterranean | http://bit.ly/2uwj5zC | Uncategorized | 1 | 35.635116 | -5.275650 | 0.001333 | 0.000000 | 0.001333 |
10 | 51587 | Central America | March 25, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 19.334475177429, -98.069823987538 | NaN | http://bit.ly/2uvDIvH, http://bit.ly/2TXAFLS | Central America | 3 | 19.334475 | -98.069824 | 0.001333 | 0.000000 | 0.001333 |
11 | 51596 | US-Mexico Border | March 24, 2019 | 2019 | Mar | 2.0 | 0.0 | 2 | NaN | 1.0 | ... | 27.403037241929, -99.478838604955 | NaN | http://bit.ly/2FO7KA3, http://bit.ly/2TSR2o3 | Northern America | 3 | 27.403037 | -99.478839 | 0.002667 | 0.000000 | 0.002667 |
12 | 51580 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
13 | 51581 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
14 | 51585 | Southeast Asia | March 23, 2019 | 2019 | Mar | 8.0 | 2.0 | 10 | NaN | 1.0 | ... | 13.865704814542, 99.587248723929 | NaN | http://bit.ly/2YqrMsT, http://bit.ly/2TzbavA | South-eastern Asia | 3 | 13.865705 | 99.587249 | 0.010667 | 0.002667 | 0.012000 |
15 | 51586 | Mediterranean | March 23, 2019 | 2019 | Mar | 4.0 | 4.0 | 8 | NaN | 3.0 | ... | 35.317034468315, 11.078928258810 | Central Mediterranean | http://bit.ly/2U1K4C4, http://bit.ly/2HJW70B, ... | Uncategorized | 3 | 35.317034 | 11.078928 | 0.005333 | 0.005333 | 0.008000 |
16 | 51595 | Mediterranean | March 23, 2019 | 2019 | Mar | 0.0 | 41.0 | 41 | NaN | NaN | ... | 32.837325915454, 12.432737422718 | Central Mediterranean | http://bit.ly/2CEoDMW, http://bit.ly/2YrtWZd, ... | Uncategorized | 4 | 32.837326 | 12.432737 | 0.000000 | 0.054667 | 0.027333 |
17 | 51594 | Mediterranean | March 22, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.324581077512, -2.955065558274 | Western Mediterranean | http://bit.ly/2OFEf7r, http://bit.ly/2TQg07y | Uncategorized | 3 | 35.324581 | -2.955066 | 0.001333 | 0.000000 | 0.001333 |
18 | 51578 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
19 | 51579 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
20 | 51584 | Central America | March 20, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 24.057148900000, -105.457669800000 | NaN | https://bit.ly/2JFeB4c, https://bit.ly/2Wqx8lZ | Central America | 1 | 24.057149 | -105.457670 | 0.001333 | 0.000000 | 0.001333 |
21 | 51548 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 3.0 | 4 | 15.0 | NaN | ... | 32.816243467052, 12.530851413107 | Central Mediterranean | http://bit.ly/2ue4qZx, https://bit.ly/2TR74nh,... | Uncategorized | 3 | 32.816243 | 12.530851 | 0.001333 | 0.004000 | 0.003333 |
22 | 51593 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.320534947419, -2.951115676707 | Western Mediterranean | http://bit.ly/2uCBhaL, http://bit.ly/2YHKg8k | Uncategorized | 3 | 35.320535 | -2.951116 | 0.001333 | 0.000000 | 0.001333 |
23 | 51546 | Mediterranean | March 18, 2019 | 2019 | Mar | 3.0 | 0.0 | 3 | 52.0 | NaN | ... | 35.267895220573, -2.799562392362 | Western Mediterranean | http://bit.ly/2TVZas5, http://bit.ly/2HHj7MI | Uncategorized | 4 | 35.267895 | -2.799562 | 0.004000 | 0.000000 | 0.004000 |
24 | 51545 | Central America | March 17, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 25.563914159609, -103.492111622910 | NaN | http://bit.ly/2Y8xOOy | Central America | 1 | 25.563914 | -103.492112 | 0.001333 | 0.000000 | 0.001333 |
25 | 51547 | North Africa | March 17, 2019 | 2019 | Mar | 0.0 | 19.0 | 19 | 1.0 | NaN | ... | 29.425766218075, -10.453333285156 | Western African | https://bit.ly/2TiLeUS, https://twitter.com/al... | Uncategorized | 1 | 29.425766 | -10.453333 | 0.000000 | 0.025333 | 0.012667 |
26 | 51577 | US-Mexico Border | March 15, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.331803200000, -112.524509300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.331803 | -112.524509 | 0.001333 | 0.000000 | 0.001333 |
27 | 51544 | Mediterranean | March 14, 2019 | 2019 | Mar | 1.0 | 44.0 | 45 | 22.0 | 3.0 | ... | 35.298258842764, -2.688431354400 | Western Mediterranean | http://bit.ly/2O7CPT5, http://bit.ly/2TDZT1O, ... | Uncategorized | 4 | 35.298259 | -2.688431 | 0.001333 | 0.058667 | 0.030667 |
28 | 51576 | US-Mexico Border | March 13, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.794415600000, -112.446447300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 31.794416 | -112.446447 | 0.001333 | 0.000000 | 0.001333 |
29 | 51534 | Caribbean | March 11, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 15.0 | NaN | ... | 18.232326183657, -69.057353261657 | NaN | http://bit.ly/2UArflI, http://bit.ly/2VVIpuu | Caribbean | 3 | 18.232326 | -69.057353 | 0.001333 | 0.000000 | 0.001333 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
5312 | 39230 | Mediterranean | February 27, 2014 | 2014 | Feb | 7.0 | 0.0 | 7 | NaN | NaN | ... | 33.159700000000, 15.183100000000 | Central Mediterranean | http://bit.ly/1lvR4Ka | Uncategorized | 1 | 33.159700 | 15.183100 | 0.009333 | 0.000000 | 0.009333 |
5313 | 39229 | Horn of Africa | February 26, 2014 | 2014 | Feb | 11.0 | 6.0 | 17 | 0.0 | NaN | ... | 20.280200000000, 38.512600000000 | NaN | http://bit.ly/1pTfmSe | Uncategorized | 4 | 20.280200 | 38.512600 | 0.014667 | 0.008000 | 0.018667 |
5314 | 39379 | South Asia | February 26, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 0.0 | NaN | ... | 25.184100000000, 88.905500000000 | NaN | http://bit.ly/1vs5kco | Southern Asia | 1 | 25.184100 | 88.905500 | 0.001333 | 0.000000 | 0.001333 |
5315 | 39271 | US-Mexico Border | February 25, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5316 | 39270 | US-Mexico Border | February 21, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5317 | 39196 | Caribbean | February 20, 2014 | 2014 | Feb | 8.0 | 0.0 | 8 | 0.0 | NaN | ... | 18.450500000000, -67.796600000000 | NaN | http://bit.ly/1sWDTeE | Caribbean | 1 | 18.450500 | -67.796600 | 0.010667 | 0.000000 | 0.010667 |
5318 | 39269 | US-Mexico Border | February 20, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5319 | 39211 | US-Mexico Border | February 18, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 32.554300000000, -117.052000000000 | Central America to US | http://cnn.it/1jGgOUo | Northern America | 1 | 32.554300 | -117.052000 | 0.001333 | 0.000000 | 0.001333 |
5320 | 39228 | Mediterranean | February 17, 2014 | 2014 | Feb | 2.0 | 0.0 | 2 | 121.0 | NaN | ... | 34.564500000000, 15.886200000000 | Central Mediterranean | http://bit.ly/V7JIqE | Uncategorized | 1 | 34.564500 | 15.886200 | 0.002667 | 0.000000 | 0.002667 |
5321 | 39268 | US-Mexico Border | February 17, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5322 | 39266 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5323 | 39267 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5324 | 39265 | US-Mexico Border | February 11, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5325 | 39404 | Mediterranean | February 06, 2014 | 2014 | Feb | 15.0 | 0.0 | 15 | 0.0 | NaN | ... | 35.879300000000, -5.364070000000 | Western Mediterranean | http://bit.ly/U4b8wu, http://bit.ly/2kyBK8g, h... | Uncategorized | 1 | 35.879300 | -5.364070 | 0.020000 | 0.000000 | 0.020000 |
5326 | 39195 | Caribbean | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 26.116000000000, -80.046400000000 | NaN | http://bit.ly/1zU2LSq | Caribbean | 1 | 26.116000 | -80.046400 | 0.001333 | 0.000000 | 0.001333 |
5327 | 39373 | Europe | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 50.935500000000, 1.878660000000 | Calais to United Kingdom | http://bit.ly/1icTIF9 | Western Europe | 4 | 50.935500 | 1.878660 | 0.001333 | 0.000000 | 0.001333 |
5328 | 39263 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5329 | 39264 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5330 | 39262 | US-Mexico Border | January 28, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5331 | 39208 | US-Mexico Border | January 25, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5332 | 39260 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5333 | 39261 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5334 | 39259 | US-Mexico Border | January 22, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5335 | 39403 | Mediterranean | January 19, 2014 | 2014 | Jan | 12.0 | 0.0 | 12 | NaN | 9.0 | ... | 37.283200000000, 27.158200000000 | Eastern Mediterranean | http://bit.ly/2aMCwfg | Uncategorized | 1 | 37.283200 | 27.158200 | 0.016000 | 0.000000 | 0.016000 |
5336 | 39258 | US-Mexico Border | January 17, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5337 | 39207 | US-Mexico Border | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.344700000000, -109.545000000000 | Central America to US | http://bit.ly/1qfIw00 | Northern America | 5 | 31.344700 | -109.545000 | 0.001333 | 0.000000 | 0.001333 |
5338 | 39368 | Europe | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 59.155100000000, 27.858600000000 | NaN | http://bit.ly/1rTFTjR | Northern Europe | 1 | 59.155100 | 27.858600 | 0.001333 | 0.000000 | 0.001333 |
5339 | 39257 | US-Mexico Border | January 14, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5340 | 39256 | US-Mexico Border | January 12, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5341 | 39206 | US-Mexico Border | January 06, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | http://humaneborders.info/ | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5342 rows × 25 columns
dataML.drop(dataML[dataML['Location Description'].isnull() == True].index, inplace=True)
dataML.shape
(5333, 25)
dataML = dataML.reset_index(drop=True)
dataML
Web ID | Region of Incident | Reported Date | Reported Year | Reported Month | Number Dead | Minimum Estimated Number of Missing | Total Dead and Missing | Number of Survivors | Number of Females | ... | Location Coordinates | Migration Route | URL | UNSD Geographical Grouping | Source Quality | latitude | longitude | scaledDead | scaledMissing | magnitude | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51602 | Central America | April 03, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 23.260560931726, -102.337369154380 | NaN | http://bit.ly/2IcH2nB | Central America | 1 | 23.260561 | -102.337369 | 0.001333 | 0.000000 | 0.001333 |
1 | 51601 | Mediterranean | April 02, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.358181389497, -3.963637678454 | Western Mediterranean | https://www.facebook.com/AmdhNador/posts/23026... | Uncategorized | 4 | 35.358181 | -3.963638 | 0.001333 | 0.000000 | 0.001333 |
2 | 51600 | Mediterranean | April 01, 2019 | 2019 | Apr | 1.0 | 0.0 | 1 | 12.0 | NaN | ... | 35.980298764742, -5.773669680016 | Western Mediterranean | http://bit.ly/2FIuwcB, http://bit.ly/2uDo2GR | Uncategorized | 3 | 35.980299 | -5.773670 | 0.001333 | 0.000000 | 0.001333 |
3 | 51597 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 14.0 | NaN | ... | 41.420003176858, 22.222123150364 | Western Balkans | NaN | Southern Europe | 5 | 41.420003 | 22.222123 | 0.001333 | 0.000000 | 0.001333 |
4 | 51598 | Europe | March 31, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 44.983703900000, 15.476410700000 | Western Balkans | http://bit.ly/2YN6OVc, http://bit.ly/2uDzdiJ, ... | Southern Europe | 5 | 44.983704 | 15.476411 | 0.001333 | 0.000000 | 0.001333 |
5 | 51599 | Caribbean | March 31, 2019 | 2019 | Mar | 17.0 | 2.0 | 19 | 14.0 | NaN | ... | 21.544304856421, -72.464247663854 | NaN | https://hrld.us/2CLDhC8, http://bit.ly/2U8gMlj... | Caribbean | 5 | 21.544305 | -72.464248 | 0.022667 | 0.002667 | 0.024000 |
6 | 51591 | Mediterranean | March 28, 2019 | 2019 | Mar | 0.0 | 2.0 | 2 | 36.0 | NaN | ... | 38.362368696592, 26.172509473654 | Eastern Mediterranean | NaN | Uncategorized | 5 | 38.362369 | 26.172509 | 0.000000 | 0.002667 | 0.001333 |
7 | 51588 | Mediterranean | March 26, 2019 | 2019 | Mar | 4.0 | 0.0 | 4 | 11.0 | 3.0 | ... | 39.441975591614, 26.378816195919 | Eastern Mediterranean | http://bit.ly/2YmiPAN | Uncategorized | 5 | 39.441976 | 26.378816 | 0.005333 | 0.000000 | 0.005333 |
8 | 51589 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.871901875921, -5.343037665842 | Western Mediterranean | http://bit.ly/2uyj7qO, http://bit.ly/2uwj5zC | Uncategorized | 3 | 35.871902 | -5.343038 | 0.001333 | 0.000000 | 0.001333 |
9 | 51590 | Mediterranean | March 26, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 35.635115912988, -5.275650103548 | Western Mediterranean | http://bit.ly/2uwj5zC | Uncategorized | 1 | 35.635116 | -5.275650 | 0.001333 | 0.000000 | 0.001333 |
10 | 51587 | Central America | March 25, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 19.334475177429, -98.069823987538 | NaN | http://bit.ly/2uvDIvH, http://bit.ly/2TXAFLS | Central America | 3 | 19.334475 | -98.069824 | 0.001333 | 0.000000 | 0.001333 |
11 | 51596 | US-Mexico Border | March 24, 2019 | 2019 | Mar | 2.0 | 0.0 | 2 | NaN | 1.0 | ... | 27.403037241929, -99.478838604955 | NaN | http://bit.ly/2FO7KA3, http://bit.ly/2TSR2o3 | Northern America | 3 | 27.403037 | -99.478839 | 0.002667 | 0.000000 | 0.002667 |
12 | 51580 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
13 | 51581 | US-Mexico Border | March 23, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
14 | 51585 | Southeast Asia | March 23, 2019 | 2019 | Mar | 8.0 | 2.0 | 10 | NaN | 1.0 | ... | 13.865704814542, 99.587248723929 | NaN | http://bit.ly/2YqrMsT, http://bit.ly/2TzbavA | South-eastern Asia | 3 | 13.865705 | 99.587249 | 0.010667 | 0.002667 | 0.012000 |
15 | 51586 | Mediterranean | March 23, 2019 | 2019 | Mar | 4.0 | 4.0 | 8 | NaN | 3.0 | ... | 35.317034468315, 11.078928258810 | Central Mediterranean | http://bit.ly/2U1K4C4, http://bit.ly/2HJW70B, ... | Uncategorized | 3 | 35.317034 | 11.078928 | 0.005333 | 0.005333 | 0.008000 |
16 | 51595 | Mediterranean | March 23, 2019 | 2019 | Mar | 0.0 | 41.0 | 41 | NaN | NaN | ... | 32.837325915454, 12.432737422718 | Central Mediterranean | http://bit.ly/2CEoDMW, http://bit.ly/2YrtWZd, ... | Uncategorized | 4 | 32.837326 | 12.432737 | 0.000000 | 0.054667 | 0.027333 |
17 | 51594 | Mediterranean | March 22, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.324581077512, -2.955065558274 | Western Mediterranean | http://bit.ly/2OFEf7r, http://bit.ly/2TQg07y | Uncategorized | 3 | 35.324581 | -2.955066 | 0.001333 | 0.000000 | 0.001333 |
18 | 51578 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
19 | 51579 | US-Mexico Border | March 21, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.057499000000, -111.666072500000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.057499 | -111.666072 | 0.001333 | 0.000000 | 0.001333 |
20 | 51584 | Central America | March 20, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 24.057148900000, -105.457669800000 | NaN | https://bit.ly/2JFeB4c, https://bit.ly/2Wqx8lZ | Central America | 1 | 24.057149 | -105.457670 | 0.001333 | 0.000000 | 0.001333 |
21 | 51548 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 3.0 | 4 | 15.0 | NaN | ... | 32.816243467052, 12.530851413107 | Central Mediterranean | http://bit.ly/2ue4qZx, https://bit.ly/2TR74nh,... | Uncategorized | 3 | 32.816243 | 12.530851 | 0.001333 | 0.004000 | 0.003333 |
22 | 51593 | Mediterranean | March 19, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | 1.0 | ... | 35.320534947419, -2.951115676707 | Western Mediterranean | http://bit.ly/2uCBhaL, http://bit.ly/2YHKg8k | Uncategorized | 3 | 35.320535 | -2.951116 | 0.001333 | 0.000000 | 0.001333 |
23 | 51546 | Mediterranean | March 18, 2019 | 2019 | Mar | 3.0 | 0.0 | 3 | 52.0 | NaN | ... | 35.267895220573, -2.799562392362 | Western Mediterranean | http://bit.ly/2TVZas5, http://bit.ly/2HHj7MI | Uncategorized | 4 | 35.267895 | -2.799562 | 0.004000 | 0.000000 | 0.004000 |
24 | 51545 | Central America | March 17, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 25.563914159609, -103.492111622910 | NaN | http://bit.ly/2Y8xOOy | Central America | 1 | 25.563914 | -103.492112 | 0.001333 | 0.000000 | 0.001333 |
25 | 51547 | North Africa | March 17, 2019 | 2019 | Mar | 0.0 | 19.0 | 19 | 1.0 | NaN | ... | 29.425766218075, -10.453333285156 | Western African | https://bit.ly/2TiLeUS, https://twitter.com/al... | Uncategorized | 1 | 29.425766 | -10.453333 | 0.000000 | 0.025333 | 0.012667 |
26 | 51577 | US-Mexico Border | March 15, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.331803200000, -112.524509300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 32.331803 | -112.524509 | 0.001333 | 0.000000 | 0.001333 |
27 | 51544 | Mediterranean | March 14, 2019 | 2019 | Mar | 1.0 | 44.0 | 45 | 22.0 | 3.0 | ... | 35.298258842764, -2.688431354400 | Western Mediterranean | http://bit.ly/2O7CPT5, http://bit.ly/2TDZT1O, ... | Uncategorized | 4 | 35.298259 | -2.688431 | 0.001333 | 0.058667 | 0.030667 |
28 | 51576 | US-Mexico Border | March 13, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.794415600000, -112.446447300000 | NaN | http://www.humaneborders.info/ | Northern America | 5 | 31.794416 | -112.446447 | 0.001333 | 0.000000 | 0.001333 |
29 | 51534 | Caribbean | March 11, 2019 | 2019 | Mar | 1.0 | 0.0 | 1 | 15.0 | NaN | ... | 18.232326183657, -69.057353261657 | NaN | http://bit.ly/2UArflI, http://bit.ly/2VVIpuu | Caribbean | 3 | 18.232326 | -69.057353 | 0.001333 | 0.000000 | 0.001333 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
5303 | 39230 | Mediterranean | February 27, 2014 | 2014 | Feb | 7.0 | 0.0 | 7 | NaN | NaN | ... | 33.159700000000, 15.183100000000 | Central Mediterranean | http://bit.ly/1lvR4Ka | Uncategorized | 1 | 33.159700 | 15.183100 | 0.009333 | 0.000000 | 0.009333 |
5304 | 39229 | Horn of Africa | February 26, 2014 | 2014 | Feb | 11.0 | 6.0 | 17 | 0.0 | NaN | ... | 20.280200000000, 38.512600000000 | NaN | http://bit.ly/1pTfmSe | Uncategorized | 4 | 20.280200 | 38.512600 | 0.014667 | 0.008000 | 0.018667 |
5305 | 39379 | South Asia | February 26, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 0.0 | NaN | ... | 25.184100000000, 88.905500000000 | NaN | http://bit.ly/1vs5kco | Southern Asia | 1 | 25.184100 | 88.905500 | 0.001333 | 0.000000 | 0.001333 |
5306 | 39271 | US-Mexico Border | February 25, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5307 | 39270 | US-Mexico Border | February 21, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5308 | 39196 | Caribbean | February 20, 2014 | 2014 | Feb | 8.0 | 0.0 | 8 | 0.0 | NaN | ... | 18.450500000000, -67.796600000000 | NaN | http://bit.ly/1sWDTeE | Caribbean | 1 | 18.450500 | -67.796600 | 0.010667 | 0.000000 | 0.010667 |
5309 | 39269 | US-Mexico Border | February 20, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5310 | 39211 | US-Mexico Border | February 18, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 32.554300000000, -117.052000000000 | Central America to US | http://cnn.it/1jGgOUo | Northern America | 1 | 32.554300 | -117.052000 | 0.001333 | 0.000000 | 0.001333 |
5311 | 39228 | Mediterranean | February 17, 2014 | 2014 | Feb | 2.0 | 0.0 | 2 | 121.0 | NaN | ... | 34.564500000000, 15.886200000000 | Central Mediterranean | http://bit.ly/V7JIqE | Uncategorized | 1 | 34.564500 | 15.886200 | 0.002667 | 0.000000 | 0.002667 |
5312 | 39268 | US-Mexico Border | February 17, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5313 | 39266 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5314 | 39267 | US-Mexico Border | February 16, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5315 | 39265 | US-Mexico Border | February 11, 2014 | 2014 | Feb | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5316 | 39404 | Mediterranean | February 06, 2014 | 2014 | Feb | 15.0 | 0.0 | 15 | 0.0 | NaN | ... | 35.879300000000, -5.364070000000 | Western Mediterranean | http://bit.ly/U4b8wu, http://bit.ly/2kyBK8g, h... | Uncategorized | 1 | 35.879300 | -5.364070 | 0.020000 | 0.000000 | 0.020000 |
5317 | 39195 | Caribbean | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 26.116000000000, -80.046400000000 | NaN | http://bit.ly/1zU2LSq | Caribbean | 1 | 26.116000 | -80.046400 | 0.001333 | 0.000000 | 0.001333 |
5318 | 39373 | Europe | January 30, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 50.935500000000, 1.878660000000 | Calais to United Kingdom | http://bit.ly/1icTIF9 | Western Europe | 4 | 50.935500 | 1.878660 | 0.001333 | 0.000000 | 0.001333 |
5319 | 39263 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5320 | 39264 | US-Mexico Border | January 29, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5321 | 39262 | US-Mexico Border | January 28, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5322 | 39208 | US-Mexico Border | January 25, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5323 | 39260 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5324 | 39261 | US-Mexico Border | January 24, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5325 | 39259 | US-Mexico Border | January 22, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5326 | 39403 | Mediterranean | January 19, 2014 | 2014 | Jan | 12.0 | 0.0 | 12 | NaN | 9.0 | ... | 37.283200000000, 27.158200000000 | Eastern Mediterranean | http://bit.ly/2aMCwfg | Uncategorized | 1 | 37.283200 | 27.158200 | 0.016000 | 0.000000 | 0.016000 |
5327 | 39258 | US-Mexico Border | January 17, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5328 | 39207 | US-Mexico Border | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 31.344700000000, -109.545000000000 | Central America to US | http://bit.ly/1qfIw00 | Northern America | 5 | 31.344700 | -109.545000 | 0.001333 | 0.000000 | 0.001333 |
5329 | 39368 | Europe | January 16, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | 2.0 | NaN | ... | 59.155100000000, 27.858600000000 | NaN | http://bit.ly/1rTFTjR | Northern Europe | 1 | 59.155100 | 27.858600 | 0.001333 | 0.000000 | 0.001333 |
5330 | 39257 | US-Mexico Border | January 14, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5331 | 39256 | US-Mexico Border | January 12, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | NaN | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5332 | 39206 | US-Mexico Border | January 06, 2014 | 2014 | Jan | 1.0 | 0.0 | 1 | NaN | NaN | ... | 32.058118300000, -111.623576100000 | Central America to US | http://humaneborders.info/ | Northern America | 5 | 32.058118 | -111.623576 | 0.001333 | 0.000000 | 0.001333 |
5333 rows × 25 columns
Отлично, данные готовы, можно начинать машинное обучение!
from sklearn.feature_extraction.text import TfidfVectorizer
vec = TfidfVectorizer() #текстовое описание локации мы будем обрабатывать методом TF-IDF
vec.fit_transform(dataML['Location Description'])
<5333x3277 sparse matrix of type '<class 'numpy.float64'>' with 30761 stored elements in Compressed Sparse Row format>
Предсказывать будем с помощью метода опорных векторов. Для начала давайте подберем лучший параметр для обучения.
#подберем лучший параметр для метода опорных векторов
from sklearn.svm import SVC
from sklearn.cross_validation import KFold
from sklearn.model_selection import GridSearchCV
import numpy as np
#ValueError: Unknown label type: ‘continuous’
#решение взято тут - https://www.kaggle.com/pratsiuk/valueerror-unknown-label-type-continuous
lab_enc = preprocessing.LabelEncoder()
training_scores_encoded = lab_enc.fit_transform(dataML['magnitude'])
grid = {'C': np.power(10.0, np.arange(-1, 1))}
cv = KFold(len(training_scores_encoded), n_folds=5, shuffle=True, random_state=241)
model = SVC(kernel='linear', random_state=241)
const = GridSearchCV(model, grid, scoring='accuracy', cv=cv)
const.fit(vec.transform(dataML['Location Description']), training_scores_encoded)
best_const = const.best_params_.get('C')
print(best_const)
/Users/Daniil/anaconda3/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning)
1.0
Построим модель с ранее найденным оптимальным параметром
model = SVC(kernel='linear', random_state=241, C = best_const)
model.fit(vec.transform(dataML['Location Description']), training_scores_encoded)
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, decision_function_shape='ovr', degree=3, gamma='auto', kernel='linear', max_iter=-1, probability=False, random_state=241, shrinking=True, tol=0.001, verbose=False)
Интересно, а какие слова из описания сильнее всего увеличивают или уменьшают магнитуду?
word = vec.get_feature_names()
coef = abs(model.coef_.data)
lst = list(zip(coef, word))
df = pd.DataFrame(lst)
df.sort_values(by=0, ascending=False)
0 | 1 | |
---|---|---|
1498 | 1.251531 | international |
438 | 1.251531 | balau |
2986 | 1.251531 | tostaditas |
108 | 1.251531 | 50km |
3214 | 1.251531 | yamoussoukro |
1580 | 1.251531 | jonquera |
2206 | 1.094850 | occurred |
2658 | 1.050922 | see |
1947 | 0.988499 | med |
1865 | 0.918991 | mamfe |
2485 | 0.917374 | ravadinovo |
2151 | 0.907873 | next |
831 | 0.888227 | col |
735 | 0.863365 | cascajal |
2787 | 0.818718 | springs |
733 | 0.813052 | casa |
2179 | 0.807834 | northwestern |
2203 | 0.807074 | obregón |
2496 | 0.806541 | red |
2792 | 0.798384 | stadium |
2186 | 0.785192 | novo |
773 | 0.755398 | charles |
1871 | 0.752013 | mangrove |
138 | 0.749863 | 83 |
1647 | 0.746148 | kelian |
126 | 0.739611 | 66653 |
791 | 0.739611 | chinameca |
849 | 0.739611 | comisión |
710 | 0.739611 | cap |
3004 | 0.739611 | transit |
... | ... | ... |
1273 | 0.002330 | geherre |
1024 | 0.002072 | docks |
2173 | 0.002038 | norte |
2109 | 0.001956 | n32 |
2108 | 0.001841 | n216 |
532 | 0.001720 | bicske |
2092 | 0.001611 | mutred |
1260 | 0.001589 | garisa |
651 | 0.001547 | bvd |
1280 | 0.001505 | gevgelija |
1281 | 0.001457 | geyikova |
305 | 0.001453 | amoda |
1726 | 0.001413 | kurfrah |
647 | 0.001404 | burkina |
640 | 0.001339 | bulgarian |
595 | 0.001289 | boumerdès |
1002 | 0.001064 | dioulasso |
646 | 0.000846 | burial |
618 | 0.000649 | brigde |
2123 | 0.000600 | narino |
2124 | 0.000596 | nariño |
2122 | 0.000590 | naranjas |
533 | 0.000509 | big |
668 | 0.000466 | cagliari |
670 | 0.000466 | cahoacán |
667 | 0.000466 | cage |
669 | 0.000376 | caguama |
1482 | 0.000350 | incident |
1483 | 0.000334 | independencia |
1481 | 0.000323 | in |
3277 rows × 2 columns
#obregón город на юге калифорнии
#jonquera город на границе испании
Реализуем поиск места по его фотографии из ВК. К сожалению, данный метод поиска ограничен возможностями поиска Google.
#soup скрэппинг не работает((( так что юзаем селениум
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
def getLocation(urlImage):
urlGoogleImageSearch = 'https://images.google.com/imghp?sbi=1&hl=en-us'
browser = webdriver.Safari()
browser.get(urlGoogleImageSearch)
search = browser.find_element_by_name('image_url')
search.send_keys(urlImage)
search.send_keys(Keys.RETURN)
time.sleep(5) #ждем пока прогрузится новая страница
bs = BeautifulSoup(browser.page_source)
for link in bs.findAll('a', href=True, text='Maps'):
urlMaps = link['href']
break
browser.get(urlMaps)
time.sleep(5)
page = BeautifulSoup(browser.page_source)
#print(browser.page_source)
for heading in page.findAll('h1'):
location = heading.text
break
time.sleep(5)
browser.quit()
return location
def getVkImage(urlVkImage):
browser = webdriver.Safari()
browser.get(urlVkImage)
time.sleep(3)
page = BeautifulSoup(browser.page_source)
for img in page.findAll('img'):
url = img['src']
break
browser.quit()
return url
urlVkImage = 'https://vk.com/russia.travel.official?z=photo-61009220_456243158%2Falbum-61009220_00%2Frev'
urlImage = getVkImage(urlVkImage)
urlImage
/Users/Daniil/anaconda3/lib/python3.6/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently. The code that caused this warning is on line 193 of the file /Users/Daniil/anaconda3/lib/python3.6/runpy.py. To get rid of this warning, change code that looks like this: BeautifulSoup(YOUR_MARKUP}) to this: BeautifulSoup(YOUR_MARKUP, "lxml") markup_type=markup_type))
'https://pp.userapi.com/c849120/v849120268/77880/aZGbbgxjN5c.jpg'
place = getLocation(urlImage)
place
/Users/Daniil/anaconda3/lib/python3.6/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently. The code that caused this warning is on line 193 of the file /Users/Daniil/anaconda3/lib/python3.6/runpy.py. To get rid of this warning, change code that looks like this: BeautifulSoup(YOUR_MARKUP}) to this: BeautifulSoup(YOUR_MARKUP, "lxml") markup_type=markup_type))
'Monument Millennium of Russia'
Я у мамы Илон Маск вжух! Воспользуемся API NASA для эмуляции приключений на Марсе) Будем делать запрос к камерам разных марсоходов и собирать в фильм.
#https://api.nasa.gov/api.html#MarsPhotos
import imageio
from PIL import Image
import requests
from io import BytesIO
import requests
count = 0
cameraType = ['rhaz', 'chemcam', 'mast']
countCamera = dict()
for camera in cameraType:
url = 'https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=1000&camera=' + camera + '&api_key=DEMO_KEY'
r = requests.get(url)
q = r.json()
count = 0
for i in q['photos']:
count = count + 1
r = requests.get(i['img_src'])
img = Image.open(BytesIO(r.content))
img.save('images/' + camera + str(count) + '.png')
if count == 30:
break
countCamera[camera] = count
countCamera
{'chemcam': 4, 'mast': 30, 'rhaz': 2}
теперь соберем все в gif
def imagesToGif(camera, numberOfImages, start = 1, step = 1, cameraSubType = ''):
with imageio.get_writer('images/movie-' + camera + cameraSubType + '.gif', mode='I') as writer:
for i in range(start, numberOfImages + 1, step):
image = imageio.imread('images/' + camera + str(i) + '.png')
writer.append_data(image)
return
for camera in cameraType:
if camera == 'mast':
imagesToGif(camera, countCamera[camera], step = 2, cameraSubType = '-one')
imagesToGif(camera, countCamera[camera], step = 2, start = 2, cameraSubType = '-two')
else:
imagesToGif(camera, countCamera[camera])
#запусти ячейки чтобы увидеть gif
#запусти ячейки чтобы увидеть gif
#запусти ячейки чтобы увидеть gif
#запусти ячейки чтобы увидеть gif