<jupyter_start><jupyter_text>Dataset - Global Terrorism Database by START (Study of Terrorism and Responses to Terrorism)Link - https://www.start.umd.edu/gtd/access/ The GTD is an open-source database, which provides information on domestic and international terrorist attacks around the world since 1970, and now includes more than 200,000 events. For each event, a wide range of information is available, including the date and location of the incident, the weapons used, nature of the target, the number of casualties, and – when identifiable – the group or individual responsible.  Import Libraries<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns<jupyter_output><empty_output><jupyter_text>Load dataset<jupyter_code>globalterrorismdb = pd.read_excel("D:/St. Clair/F21/103 - Analytics Tools/Group Project/globalterrorismdb.xlsx")
globalterrorismdb<jupyter_output><empty_output><jupyter_text>Shape of the Dataset<jupyter_code>globalterrorismdb.shape
globalterrorismdb.columns<jupyter_output><empty_output><jupyter_text>Sample Data<jupyter_code>globalterrorismdb.head()
globalterrorismdb.tail()<jupyter_output><empty_output><jupyter_text>Concise Summary of the dataset<jupyter_code>globalterrorismdb.isnull().sum()
globalterrorismdb.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 201931 entries, 0 to 201930
Columns: 135 entries, eventid to related
dtypes: datetime64[ns](1), float64(54), int64(23), object(57)
memory usage: 208.0+ MB<jupyter_text>Descriptive Statistics for the dataset<jupyter_code>#Filtering dataset to calculate correlation between important columns
gtd = globalterrorismdb[['iyear','imonth','iday','country_txt','region','region_txt','provstate','city'
                         ,'success','suicide','attacktype1_txt','targtype1_txt','weaptype1_txt',
               'nkill','nwound','gname']]
gtd.describe()
gtd.describe(include=['O'])<jupyter_output><empty_output><jupyter_text>Correlation between columns in the dataframe<jupyter_code>gtd_corr = gtd.corr()
round(gtd_corr,2)
plt.figure(figsize=(15,10))
hmap = sns.heatmap(gtd_corr);
hmap.set_title("Correlation between Columns in the Dataset", color ="blue", fontsize = 20)
plt.xlabel("Column Names", fontsize=15, color = "darkblue")
plt.ylabel("Column Names", fontsize=15, color = "darkblue")
plt.show()<jupyter_output><empty_output><jupyter_text>Analyzing data by each columns<jupyter_code>gtd.iyear.value_counts(ascending = False)
plt.figure(figsize=(15,10))
plot = sns.countplot(x ='iyear', data = gtd)
plot.set_title("No. of Attacks per Year", fontsize = 20, color ="blue")
plt.xlabel("Years", fontsize=15, color = "darkblue")
plt.ylabel("Number of Attacks", fontsize=15, color = "darkblue")
plot.set_xticklabels(plot.get_xticklabels(), rotation=45, horizontalalignment='right')
plt.show()
gtd.region_txt.value_counts()
plt.figure(figsize = (15,10))
plot = sns.countplot(x = 'region_txt', data = gtd)
plot.set_title("Region wise Attacks", fontsize = 20, color = "blue")
plt.xlabel("Regions", fontsize=15, color = "darkblue")
plt.ylabel("Number of Attacks", fontsize=15, color = "darkblue")
plot.set_xticklabels(plot.get_xticklabels(), rotation = 45, horizontalalignment = 'right')
plt.show()
gtd.weaptype1_txt.value_counts()
plt.figure(figsize = (15,10))
plot = sns.countplot(x = 'weaptype1_txt', data = gtd)
plot.set_title("Types of Weapons Used", fontsize = 20, color = "blue")
plt.xlabel("Weapons", fontsize=15, color = "darkblue")
plt.ylabel("Number of Attacks", fontsize=15, color = "darkblue")
plot.set_xticklabels(plot.get_xticklabels(), rotation = 45, horizontalalignment = 'right')
plt.show()
gtd.targtype1_txt.value_counts()
plt.figure(figsize = (20,8))
plot = sns.countplot(x = 'targtype1_txt', data = gtd)
plot.set_title("Major Targets", fontsize = 20, color = "blue")
plt.xlabel("Target Types", fontsize=15, color = "darkblue")
plt.ylabel("Number of Attacks", fontsize=15, color = "darkblue")
plot.set_xticklabels(plot.get_xticklabels(), rotation = 45, horizontalalignment = 'right')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13361117921059082, 'fraction_numerical': 0.027702868350085806, 'mean_word_length': 7.5, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '97213', 'license': 'MIT', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1362, 'n_words': 309, 'path': 'Group008_EDA.ipynb', 'repo_name': 'nagendra009/DAB103_ProjectFiles_Group-008', 'size': '4079'}