<jupyter_start><jupyter_text>***The Saprks Foundation: TASK-4***  ***- perform ‘Exploratory Data Analysis’ on dataset ‘Global Terrorism’*** ***- As a security/defense analyst, try to find out the hot zone of terrorism.*** ***- What all security issues and insights you can derive by EDA?***  ***IMPORT ALL REQUIRED LIBRARIES***<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns<jupyter_output><empty_output><jupyter_text>***READ THE CSV FILE***<jupyter_code>df=pd.read_csv("globalterrorismdb_0718dist.csv",encoding='latin',low_memory=False)
df.head()<jupyter_output><empty_output><jupyter_text>***DATASET INFORMATION AND EDA***<jupyter_code>df.info()
df.describe()
df.columns
df.corr()
df.isnull().sum()
df.duplicated().sum()
df.shape<jupyter_output><empty_output><jupyter_text>***USING HISTOGRAM TO REPRESENT RELATIONSHIP BETWEEN ALL FEATURES***<jupyter_code>df.hist(figsize=(50,30))
plt.show()<jupyter_output><empty_output><jupyter_text>***COUNTRIES AFFECTED BY TERRORIST ATTACKS***<jupyter_code>df['country'].value_counts()
plt.figure(figsize=(20,10))
sns.barplot(x=df['country_txt'].value_counts()[:20].index,y=df['country_txt'].value_counts()[:20].values)
plt.title('TOP COUNTRIES GOT ATTACKED')
plt.xticks(rotation=70)
plt.xlabel('COUNTRIES')
plt.ylabel('NUMBER TO ATTACKS')
plt.show()<jupyter_output><empty_output><jupyter_text>***REGION AFFECTED BY TERRORIST ATTACKS***<jupyter_code>df['region_txt'].value_counts()
plt.figure(figsize=(20,10))
sns.countplot(x='region_txt',data=df)
plt.xticks(rotation=70)
plt.show()
df['city'].value_counts()<jupyter_output><empty_output><jupyter_text>***NUMBER OF ATTACKS FROM 1970 TO 1986***<jupyter_code>plt.subplots(figsize=(20,10))
sns.countplot(x='iyear',data=df,palette='tab10')
plt.xticks(rotation=70)
plt.title('TERROR ATTACKS FROM 1970 TO 2017')
plt.show()<jupyter_output><empty_output><jupyter_text>***TYPE OF ATTACK USED BY TERRORISTS***<jupyter_code>plt.figure(figsize=(10,10))
sns.countplot(x=df['attacktype1_txt'],order=df['attacktype1_txt'].value_counts().index,palette='rainbow')
plt.xticks(rotation=90)
plt.xlabel('ATTACK TYPE')
plt.ylabel('NUMBER OF ATTACKS')
plt.show()<jupyter_output><empty_output><jupyter_text>***ATTACK TARGETS***<jupyter_code>plt.figure(figsize=(20,10))
sns.countplot(x=df['targtype1_txt'],order=df['targtype1_txt'].value_counts().index,palette='flare')
plt.xticks(rotation=90)
plt.xlabel('TARGETS')
plt.ylabel('NUMBER OF TARGETS')
plt.show()<jupyter_output><empty_output><jupyter_text>***NAME OF GROUP ATTACKS TERRORIST***<jupyter_code>plt.figure(figsize=(15,6))
sns.barplot(x=df['gname'].value_counts()[:20].index,y=df['gname'].value_counts()[:20].values,palette='pastel')
plt.xticks(rotation=90)
plt.title('TOATAL GROUP ATTACKS')
plt.xlabel('GROUP NAME')
plt.ylabel('TOATAL NUMBER OF ATTACKS')
plt.show()<jupyter_output><empty_output><jupyter_text>***CITIES AFFECTED BY TERRORIST***<jupyter_code>df['city'].value_counts()
plt.figure(figsize=(20,10))
sns.barplot(x=df['city'].value_counts()[:20].index,y=df['city'].value_counts()[:20].values)
plt.title('TOP CITIES GOT ATTACKED')
plt.xticks(rotation=70)
plt.xlabel('CITIES')
plt.ylabel('NUMBER TO ATTACKS')
plt.show()<jupyter_output><empty_output><jupyter_text>***WEAPON USED FOR SUPPORTING THE ATTACK TYPE VISUAL***<jupyter_code>df['weaptype1_txt'].value_counts()
plt.figure(figsize=(20,10))
color=['lightblue','red','lightpink','brown']
sns.barplot(x=df['weaptype1_txt'].value_counts()[:20].index,y=df['weaptype1_txt'].value_counts()[:20].values , palette=color)
plt.title('WEAPON USAGE')
plt.xticks(rotation=70)
plt.xlabel('WEAPON USED')
plt.ylabel('NUMBER OF TIMES')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18508511213185624, 'fraction_numerical': 0.0262091326668468, 'mean_word_length': 11.809688581314878, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '370081', 'license': 'MIT', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1455, 'n_words': 188, 'path': 'task-4.ipynb', 'repo_name': 'shrutijain0/Spark-Foundation', 'size': '3701'}