{ "cells": [ { "cell_type": "markdown", "id": "f813f5a3-c241-4a18-b1ee-e59e7309c26d", "metadata": {}, "source": [ "# Load ConflictWiki Data" ] }, { "cell_type": "code", "execution_count": 1, "id": "7de7c60b-b296-43cc-b666-b13183d450dc", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/var/folders/tb/fh7d_tg94q9_80kfqt4p54rc0000gn/T/ipykernel_47272/1430412939.py:2: DeprecationWarning: \n", "Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),\n", "(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)\n", "but was not found to be installed on your system.\n", "If this would cause problems for you,\n", "please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466\n", " \n", " import pandas as pd\n" ] } ], "source": [ "import os, itertools\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "66d8fed1-e8ca-46e2-9f8c-78064bd7934b", "metadata": {}, "source": [ "### Load Data" ] }, { "cell_type": "code", "execution_count": 3, "id": "f6354d19-e8e6-41a4-bf33-57fa227e35bc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "n conflicts: 1145, n entities: 1199\n" ] } ], "source": [ "ROOT = os.path.abspath(os.getcwd())\n", "\n", "map_path = ROOT + \"/conflict_entity_map.json\"\n", "entity_path = ROOT + \"/entity.json\"\n", "conflict_path = ROOT + \"/conflict.json\"\n", "\n", "map_df = pd.read_json(map_path, lines=True)\n", "entity_df = pd.read_json(entity_path, lines=True)\n", "conflict_df = pd.read_json(conflict_path, lines=True)\n", "\n", "print(f\"n conflicts: {len(conflict_df)}, n entities: {len(entity_df)}\")" ] }, { "cell_type": "markdown", "id": "72f86b5a-969c-4a6a-956a-5d90c7fd67e6", "metadata": {}, "source": [ "### Search for any mention of Mali in the Conflicts" ] }, { "cell_type": "code", "execution_count": 4, "id": "cbfd80b2-9bac-4873-a6ea-4f0d826e1da8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
conflict_idconflict_nameurln_belligerentsn_entitiesplacedatedate_startdate_endstatuscasualtiescasualties_numcasualties_sumstrengthstrength_numstrength_sumcommanderresult
22019362003 invasion of Iraqhttps://en.wikipedia.org/wiki/2003_invasion_of...217Iraq20 March - 1 May 20032021-03-202003-05-01None{'0': 'Coalition: 214 killed606 wounded (U.S.)...{'0': [214.0, 606.0, 24.0, 238.0, 1000.0], '1'...{'0': 2082.0, '1': 172996.0, '2': 14769.0}{'0': ': 192,000 personnel: 45,000 troops : 2,...{'0': [192000.0, 45000.0, 2000.0, 194.0, 70000...{'0': 619628.0, '1': 4015761.0}{'0': ['Babaker Shawkat B. Zebari', 'Iraqi Kur...Coalition operational success. Ba'athist Iraq ...
3207031Battle of Baghdad (2003)https://en.wikipedia.org/wiki/Battle_of_Baghda...23Baghdad, Ba'athist Iraq3-12 April 20032003-04-032003-04-12None{'0': '1,700–2,120 killed (independent estimat...{'0': [1700.0, 2120.0, 2320.0], '1': [34.0, 1....{'0': 6140.0, '1': 54.0}{'0': '45,000', '1': '30,000'}{'0': [45000.0], '1': [30000.0]}{'0': 45000.0, '1': 30000.0}{'0': ['Saddam Hussein', 'Sayf al-Din al-Rawi'...Decisive Coalition victory. Fall of Ba'ath Par...
4312905Lebanese Civil Warhttps://en.wikipedia.org/wiki/Lebanese_Civil_War428Lebanon13 April 1975 - 13 October 1990 Battle of Sido...1975-04-131990-10-13None{}{}{}{'0': '', '1': '', '2': ' 25,000 troops (1976)...{'2': [25000.0, 1976.0], '3': [1200.0, 1000.0,...{'2': 26976.0, '3': 4600.0}{'0': ['Antoine Lahad', 'Etienne Saqr', 'Menac...Taif Agreement Christian 55:45 ascendancy repl...
161138374Second Battle of Fallujahhttps://en.wikipedia.org/wiki/Second_Battle_of...29Fallujah, Iraq7 November - 23 December 20042021-11-072004-12-23None{'0': ' 95 killed 4 killedTotal: 107–110 kille...{'0': [95.0, 4.0, 107.0, 110.0, 613.0], '1': [...{'0': 929.0, '1': 4200.0, '2': 2051.0}{'0': ' 10,500 troops 2,000 Iraqi security fo...{'0': [10500.0, 2000.0, 850.0, 13350.0], '1': ...{'0': 26700.0, '1': 7700.0}{'0': ['Keith Stalder', 'Richard F. Natonski',...Coalition victory
261606497Casamance conflicthttps://en.wikipedia.org/wiki/Casamance_conflict26Casamance, Senegal1982 - 1 May 2014 main conflic2015 - present l...1982-07-052014-05-01Unilateral ceasefire; ongoing low-level violence.{'0': '', '1': '', '2': '5,000 killed in total...{'2': [5000.0, 1982.0, 60000.0]}{'2': 66982.0}{'0': ' Armed Forces of Senegal: Thousands (20...{'0': [2012.0], '1': [180.0, 2006.0]}{'0': 2012.0, '1': 2186.0}{'0': ['Senegal', 'Abdou Diouf', 'Macky Sall',...None
.........................................................
1063613418222019–2021 Persian Gulf crisishttps://en.wikipedia.org/wiki/2019–2021_Persia...265 May 2019 - present2019-05-052021-07-05{{Collapsible list titlestyle{'0': '{{Collapsible list titlestyle title tit...{'0': [2.0], '1': [3.0]}{'0': 2.0, '1': 3.0}{'0': '{{Collapsible list titlestyle title 50,...{'0': [50000.0], '1': [1.0]}{'0': 50000.0, '1': 1.0}{'0': ['Mohammed bin Salman', 'Linda Reynolds'...None
106961913712Operation Victory from Godhttps://en.wikipedia.org/wiki/Operation_Victor...25Saudi Arabia-Yemen border; Yemen-Saudi Arabia ...25 August - late September 20192021-08-252019-09-01{'0': 'unknown', '1': 'According to the Houthi...{'1': [500.0, 2000.0, 15.0]}{'1': 2515.0}{'0': 'Several infantry, armored, and missile ...{'1': [3.0]}{'1': 3.0}{'0': [], '1': []}Houthi victory
108062639473Timeline of the American-led intervention in t...https://en.wikipedia.org/wiki/Timeline_of_the_...323Syria22 September 2014 - present2014-09-222021-07-05None{'0': ' United States:8 servicemen killed (5 n...{'0': [8.0, 5.0, 2.0, 1.0, 1.0, 2.0, 1.0, 1.0,...{'0': 24.0, '1': 9520.0, '2': 406.0, '3': 4297...{'0': 'Coalition forces: Coalition forces-air ...{'1': [100000.0, 3.0, 2.0, 31000.0, 2017.0, 7....{'1': 193197.0, '2': 180000.0}{'0': ['Bahrain', 'Germany', 'Khalifa bin Zaye...Ongoing operations. 19,786 U.S. and allied air...
112065548110December 2007 Turkish incursion into northern ...https://en.wikipedia.org/wiki/December_2007_Tu...22northern IraqDecember 16, 2007 - December 26, 20072007-12-162007-12-26None{'0': 'None', '1': '200 killed, thousands woun...{'1': [200.0], '2': [1800.0, 10.0, 1.0]}{'1': 200.0, '2': 1811.0}{'0': '52 war planes', '1': '2.320-2.640 soldi...{'0': [52.0], '1': [2320.0]}{'0': 52.0, '1': 2320.0}{'0': [], '1': []}Turkish victory
114466567999Battle of Hawijahttps://een.wikipedia.org/wiki/Battle_of_Hawija24Eastern Iraq20 September 20172017-09-202017-10-08{'0': 'unknown', '1': '942 killed'}{'0': 0, '1': 942}{}{}{'0': [42000], '1': [2000]}{}{'0': ['Abdul-Amir Rashid Yarallah', 'Qais Kha...Decisive Iraqi victory
\n", "

99 rows × 18 columns

\n", "
" ], "text/plain": [ " conflict_id conflict_name \\\n", "2 201936 2003 invasion of Iraq \n", "3 207031 Battle of Baghdad (2003) \n", "4 312905 Lebanese Civil War \n", "16 1138374 Second Battle of Fallujah \n", "26 1606497 Casamance conflict \n", "... ... ... \n", "1063 61341822 2019–2021 Persian Gulf crisis \n", "1069 61913712 Operation Victory from God \n", "1080 62639473 Timeline of the American-led intervention in t... \n", "1120 65548110 December 2007 Turkish incursion into northern ... \n", "1144 66567999 Battle of Hawija \n", "\n", " url n_belligerents \\\n", "2 https://en.wikipedia.org/wiki/2003_invasion_of... 2 \n", "3 https://en.wikipedia.org/wiki/Battle_of_Baghda... 2 \n", "4 https://en.wikipedia.org/wiki/Lebanese_Civil_War 4 \n", "16 https://en.wikipedia.org/wiki/Second_Battle_of... 2 \n", "26 https://en.wikipedia.org/wiki/Casamance_conflict 2 \n", "... ... ... \n", "1063 https://en.wikipedia.org/wiki/2019–2021_Persia... 2 \n", "1069 https://en.wikipedia.org/wiki/Operation_Victor... 2 \n", "1080 https://en.wikipedia.org/wiki/Timeline_of_the_... 3 \n", "1120 https://en.wikipedia.org/wiki/December_2007_Tu... 2 \n", "1144 https://een.wikipedia.org/wiki/Battle_of_Hawija 2 \n", "\n", " n_entities place \\\n", "2 17 Iraq \n", "3 3 Baghdad, Ba'athist Iraq \n", "4 28 Lebanon \n", "16 9 Fallujah, Iraq \n", "26 6 Casamance, Senegal \n", "... ... ... \n", "1063 6 \n", "1069 5 Saudi Arabia-Yemen border; Yemen-Saudi Arabia ... \n", "1080 23 Syria \n", "1120 2 northern Iraq \n", "1144 4 Eastern Iraq \n", "\n", " date date_start \\\n", "2 20 March - 1 May 2003 2021-03-20 \n", "3 3-12 April 2003 2003-04-03 \n", "4 13 April 1975 - 13 October 1990 Battle of Sido... 1975-04-13 \n", "16 7 November - 23 December 2004 2021-11-07 \n", "26 1982 - 1 May 2014 main conflic2015 - present l... 1982-07-05 \n", "... ... ... \n", "1063 5 May 2019 - present 2019-05-05 \n", "1069 25 August - late September 2019 2021-08-25 \n", "1080 22 September 2014 - present 2014-09-22 \n", "1120 December 16, 2007 - December 26, 2007 2007-12-16 \n", "1144 20 September 2017 2017-09-20 \n", "\n", " date_end status \\\n", "2 2003-05-01 None \n", "3 2003-04-12 None \n", "4 1990-10-13 None \n", "16 2004-12-23 None \n", "26 2014-05-01 Unilateral ceasefire; ongoing low-level violence. \n", "... ... ... \n", "1063 2021-07-05 {{Collapsible list titlestyle \n", "1069 2019-09-01 \n", "1080 2021-07-05 None \n", "1120 2007-12-26 None \n", "1144 2017-10-08 \n", "\n", " casualties \\\n", "2 {'0': 'Coalition: 214 killed606 wounded (U.S.)... \n", "3 {'0': '1,700–2,120 killed (independent estimat... \n", "4 {} \n", "16 {'0': ' 95 killed 4 killedTotal: 107–110 kille... \n", "26 {'0': '', '1': '', '2': '5,000 killed in total... \n", "... ... \n", "1063 {'0': '{{Collapsible list titlestyle title tit... \n", "1069 {'0': 'unknown', '1': 'According to the Houthi... \n", "1080 {'0': ' United States:8 servicemen killed (5 n... \n", "1120 {'0': 'None', '1': '200 killed, thousands woun... \n", "1144 {'0': 'unknown', '1': '942 killed'} \n", "\n", " casualties_num \\\n", "2 {'0': [214.0, 606.0, 24.0, 238.0, 1000.0], '1'... \n", "3 {'0': [1700.0, 2120.0, 2320.0], '1': [34.0, 1.... \n", "4 {} \n", "16 {'0': [95.0, 4.0, 107.0, 110.0, 613.0], '1': [... \n", "26 {'2': [5000.0, 1982.0, 60000.0]} \n", "... ... \n", "1063 {'0': [2.0], '1': [3.0]} \n", "1069 {'1': [500.0, 2000.0, 15.0]} \n", "1080 {'0': [8.0, 5.0, 2.0, 1.0, 1.0, 2.0, 1.0, 1.0,... \n", "1120 {'1': [200.0], '2': [1800.0, 10.0, 1.0]} \n", "1144 {'0': 0, '1': 942} \n", "\n", " casualties_sum \\\n", "2 {'0': 2082.0, '1': 172996.0, '2': 14769.0} \n", "3 {'0': 6140.0, '1': 54.0} \n", "4 {} \n", "16 {'0': 929.0, '1': 4200.0, '2': 2051.0} \n", "26 {'2': 66982.0} \n", "... ... \n", "1063 {'0': 2.0, '1': 3.0} \n", "1069 {'1': 2515.0} \n", "1080 {'0': 24.0, '1': 9520.0, '2': 406.0, '3': 4297... \n", "1120 {'1': 200.0, '2': 1811.0} \n", "1144 {} \n", "\n", " strength \\\n", "2 {'0': ': 192,000 personnel: 45,000 troops : 2,... \n", "3 {'0': '45,000', '1': '30,000'} \n", "4 {'0': '', '1': '', '2': ' 25,000 troops (1976)... \n", "16 {'0': ' 10,500 troops 2,000 Iraqi security fo... \n", "26 {'0': ' Armed Forces of Senegal: Thousands (20... \n", "... ... \n", "1063 {'0': '{{Collapsible list titlestyle title 50,... \n", "1069 {'0': 'Several infantry, armored, and missile ... \n", "1080 {'0': 'Coalition forces: Coalition forces-air ... \n", "1120 {'0': '52 war planes', '1': '2.320-2.640 soldi... \n", "1144 {} \n", "\n", " strength_num \\\n", "2 {'0': [192000.0, 45000.0, 2000.0, 194.0, 70000... \n", "3 {'0': [45000.0], '1': [30000.0]} \n", "4 {'2': [25000.0, 1976.0], '3': [1200.0, 1000.0,... \n", "16 {'0': [10500.0, 2000.0, 850.0, 13350.0], '1': ... \n", "26 {'0': [2012.0], '1': [180.0, 2006.0]} \n", "... ... \n", "1063 {'0': [50000.0], '1': [1.0]} \n", "1069 {'1': [3.0]} \n", "1080 {'1': [100000.0, 3.0, 2.0, 31000.0, 2017.0, 7.... \n", "1120 {'0': [52.0], '1': [2320.0]} \n", "1144 {'0': [42000], '1': [2000]} \n", "\n", " strength_sum \\\n", "2 {'0': 619628.0, '1': 4015761.0} \n", "3 {'0': 45000.0, '1': 30000.0} \n", "4 {'2': 26976.0, '3': 4600.0} \n", "16 {'0': 26700.0, '1': 7700.0} \n", "26 {'0': 2012.0, '1': 2186.0} \n", "... ... \n", "1063 {'0': 50000.0, '1': 1.0} \n", "1069 {'1': 3.0} \n", "1080 {'1': 193197.0, '2': 180000.0} \n", "1120 {'0': 52.0, '1': 2320.0} \n", "1144 {} \n", "\n", " commander \\\n", "2 {'0': ['Babaker Shawkat B. Zebari', 'Iraqi Kur... \n", "3 {'0': ['Saddam Hussein', 'Sayf al-Din al-Rawi'... \n", "4 {'0': ['Antoine Lahad', 'Etienne Saqr', 'Menac... \n", "16 {'0': ['Keith Stalder', 'Richard F. Natonski',... \n", "26 {'0': ['Senegal', 'Abdou Diouf', 'Macky Sall',... \n", "... ... \n", "1063 {'0': ['Mohammed bin Salman', 'Linda Reynolds'... \n", "1069 {'0': [], '1': []} \n", "1080 {'0': ['Bahrain', 'Germany', 'Khalifa bin Zaye... \n", "1120 {'0': [], '1': []} \n", "1144 {'0': ['Abdul-Amir Rashid Yarallah', 'Qais Kha... \n", "\n", " result \n", "2 Coalition operational success. Ba'athist Iraq ... \n", "3 Decisive Coalition victory. Fall of Ba'ath Par... \n", "4 Taif Agreement Christian 55:45 ascendancy repl... \n", "16 Coalition victory \n", "26 None \n", "... ... \n", "1063 None \n", "1069 Houthi victory \n", "1080 Ongoing operations. 19,786 U.S. and allied air... \n", "1120 Turkish victory \n", "1144 Decisive Iraqi victory \n", "\n", "[99 rows x 18 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Define a search function\n", "def search_string(s, search):\n", " return search in str(s).lower()\n", "\n", "# Search for the string 'al' in all columns\n", "mask = conflict_df.apply(lambda x: x.map(lambda s: search_string(s, 'usa')))\n", "\n", "# Filter the DataFrame based on the mask\n", "filtered_df = conflict_df.loc[mask.any(axis=1)]\n", "filtered_df" ] }, { "cell_type": "markdown", "id": "afae2d33-ac0f-40ba-b9db-834de4e3d084", "metadata": {}, "source": [ "### Search for any mention of Mali in the Entities" ] }, { "cell_type": "code", "execution_count": 4, "id": "a2a6c05a-d940-4c25-8302-248564de33e6", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
entity_identity_nameurlisolanguageideologyreligion
228184764The Jerusalem Posthttps://en.wikipedia.org/wiki/The_Jerusalem_Post[][French, English language, French language, En...[][]
36721373Nigerhttps://en.wikipedia.org/wiki/NigerXO[French, French language, National language, S...[][]
44337278116Mujahideen Shura Council in the Environs of Je...https://en.wikipedia.org/wiki/Mujahideen_Shura...[][][][]
53321383Nigeriahttps://en.wikipedia.org/wiki/NigeriaNG[English language, English, National languages...[][]
101041487145Organization for the Islamic Revolution in the...https://en.wikipedia.org/wiki/Organization_for...[][][Religious nationalism, Conservatism, Mohammad...[Shia Islam]
1101402587Husayn ibn Alihttps://en.wikipedia.org/wiki/Husayn_ibn_Ali[][][][]
112456694430Al-Ashtar Brigadeshttps://en.wikipedia.org/wiki/Al-Ashtar_Brigades[][][Mohammad al-Husayni al-Shirazi, Shirazi][]
\n", "
" ], "text/plain": [ " entity_id entity_name \\\n", "228 184764 The Jerusalem Post \n", "367 21373 Niger \n", "443 37278116 Mujahideen Shura Council in the Environs of Je... \n", "533 21383 Nigeria \n", "1010 41487145 Organization for the Islamic Revolution in the... \n", "1101 402587 Husayn ibn Ali \n", "1124 56694430 Al-Ashtar Brigades \n", "\n", " url iso \\\n", "228 https://en.wikipedia.org/wiki/The_Jerusalem_Post [] \n", "367 https://en.wikipedia.org/wiki/Niger XO \n", "443 https://en.wikipedia.org/wiki/Mujahideen_Shura... [] \n", "533 https://en.wikipedia.org/wiki/Nigeria NG \n", "1010 https://en.wikipedia.org/wiki/Organization_for... [] \n", "1101 https://en.wikipedia.org/wiki/Husayn_ibn_Ali [] \n", "1124 https://en.wikipedia.org/wiki/Al-Ashtar_Brigades [] \n", "\n", " language \\\n", "228 [French, English language, French language, En... \n", "367 [French, French language, National language, S... \n", "443 [] \n", "533 [English language, English, National languages... \n", "1010 [] \n", "1101 [] \n", "1124 [] \n", "\n", " ideology religion \n", "228 [] [] \n", "367 [] [] \n", "443 [] [] \n", "533 [] [] \n", "1010 [Religious nationalism, Conservatism, Mohammad... [Shia Islam] \n", "1101 [] [] \n", "1124 [Mohammad al-Husayni al-Shirazi, Shirazi] [] " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def search_string(s, search):\n", " return search in str(s).lower()\n", "mask = entity_df.apply(lambda x: x.map(lambda s: search_string(s, 'usa')))\n", "filtered_df = entity_df.loc[mask.any(axis=1)]\n", "filtered_df" ] }, { "cell_type": "markdown", "id": "62bd4d61-825e-4658-96b9-df8e7e5bcc06", "metadata": {}, "source": [ "### Look into a specific conflict (Mali War)
\n", "https://en.wikipedia.org/wiki/Mali_War" ] }, { "cell_type": "code", "execution_count": 5, "id": "d0002982-5b73-4586-95ed-9393f5394895", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
conflict_idconflict_nameurln_belligerentsn_entitiesplacedatedate_startdate_endstatuscasualtiescasualties_numcasualties_sumstrengthstrength_numstrength_sumcommanderresult
48236856978Mali Warhttps://en.wikipedia.org/wiki/Mali_War317Northern Mali8 March 2004 ; access-date=28 January 2013}} ...2004-03-082013-01-01None{'0': ' 181+ killed, 400 captured Total:1,000–...{'0': [181.0, 400.0, 1000.0, 1500.0, 417.0, 10...{'0': 3725.0, '1': 2180.0, '2': 1940.0}{'0': ' 6,000–7,000(pre-war: ~12,150) 3,000 ...{'0': [6000.0, 7000.0, 12150.0, 3000.0, 2000.0...{'0': 64075.0, '1': 3000.0, '2': 4200.0}{'0': ['Brigade General', 'Dioncounda Traor', ...List of ongoing military conflicts The Tuareg ...
\n", "
" ], "text/plain": [ " conflict_id conflict_name url \\\n", "482 36856978 Mali War https://en.wikipedia.org/wiki/Mali_War \n", "\n", " n_belligerents n_entities place \\\n", "482 3 17 Northern Mali \n", "\n", " date date_start \\\n", "482 8 March 2004 ; access-date=28 January 2013}} ... 2004-03-08 \n", "\n", " date_end status casualties \\\n", "482 2013-01-01 None {'0': ' 181+ killed, 400 captured Total:1,000–... \n", "\n", " casualties_num \\\n", "482 {'0': [181.0, 400.0, 1000.0, 1500.0, 417.0, 10... \n", "\n", " casualties_sum \\\n", "482 {'0': 3725.0, '1': 2180.0, '2': 1940.0} \n", "\n", " strength \\\n", "482 {'0': ' 6,000–7,000(pre-war: ~12,150) 3,000 ... \n", "\n", " strength_num \\\n", "482 {'0': [6000.0, 7000.0, 12150.0, 3000.0, 2000.0... \n", "\n", " strength_sum \\\n", "482 {'0': 64075.0, '1': 3000.0, '2': 4200.0} \n", "\n", " commander \\\n", "482 {'0': ['Brigade General', 'Dioncounda Traor', ... \n", "\n", " result \n", "482 List of ongoing military conflicts The Tuareg ... " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "conflict_id = 36856978 \n", "conflict_df[conflict_df.conflict_id == conflict_id]" ] }, { "cell_type": "code", "execution_count": 6, "id": "fdbca9cb-165c-49c8-be66-3d61d3582d8c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "belligerents 0: ['France', 'Mali', 'Malian Armed Forces', 'Economic Community of West African States']\n", "belligerents 1: ['National Movement for the Liberation of Azawad']\n", "belligerents 2: ['Al-Qaeda', 'Ansar al-Sharia', 'Islamic State in the Greater Sahara', 'Al-Qaeda in the Islamic Maghreb', \"Jama'at Nasr al-Islam wal Muslimin\", 'Movement for Oneness and Jihad in West Africa', 'Boko Haram', 'Ansar Dine', 'Al-Mourabitoun', 'Ansaru', 'Macina Liberation Front']\n" ] } ], "source": [ "belligerent_groups = map_df[map_df.conflict_id == conflict_id]['entity_ids'].to_list()[0]\n", "involved_entities = list(itertools.chain.from_iterable(belligerent_groups))\n", "\n", "for i, entities in enumerate(belligerent_groups):\n", " entity_list = entity_df[entity_df['entity_id'].isin(entities)].entity_name.to_list()\n", " print(f'belligerents {i}: {entity_list}')" ] }, { "cell_type": "code", "execution_count": null, "id": "886dd4bd-4462-4f0a-a3f8-9d4492428a21", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "conflictwiki_venv", "language": "python", "name": "conflictwiki_venv" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 5 }