<jupyter_start><jupyter_text>We can see the dataframe contains 891 passengers' details onboard Titanic<jupyter_code># Lets look if we have any null values in data

df.isnull()<jupyter_output><empty_output><jupyter_text>Seems like we have some null values in Age and Cabin<jupyter_code># Looking at how many null values do we actually have

df.isnull().sum()<jupyter_output><empty_output><jupyter_text>So we have 177 null values in Age and 687 in Cabin 177 out of 891 is 19.86% and 687 out of 77.10% so we can't drop the rows given big percentage clearly.<jupyter_code># Lets visualize it with heatmap

sns.heatmap(df.isnull())<jupyter_output><empty_output><jupyter_text>So now we will use imputation and replace Null values of Age with Mean values.<jupyter_code># filling null ages with Mean

df['Age'] = df['Age'].fillna(df['Age'].mean())<jupyter_output><empty_output><jupyter_text>Now Lets see at the null values again<jupyter_code>df.isnull().sum()<jupyter_output><empty_output><jupyter_text>Visulaization with heatmap again<jupyter_code>sns.heatmap(df.isnull())<jupyter_output><empty_output><jupyter_text>Now we can see there are no null values in Age and can move forward to look the data closely.<jupyter_code># Types of column we have for the data

df.columns<jupyter_output><empty_output><jupyter_text>The different features of our Dataset are:1. PassengerId2. Survived or not3. Passenger Class4. Name of Passenger5. Gender of Passenger6. Age of Passenger7. Siblings/Spouse Boarding Titanic8. Number of Parents Children Aboard9. Type of Ticket they have10. Passenger's Fare11. Cabin12. Embarked - where the passenger mounted from<jupyter_code># first 5 rows

df.head()
# Columns, Number of Non-Null values per column and Data Type.

df.info()
# Number of non-empty values, Mean, Standard Deviation, min, max, 25/50/75 percentiles.

df.describe()
# Lets make a darkgrid catplot to visualize how many survived and how many died.

sns.set_style('darkgrid')
sns.countplot(x='Survived',data=df)<jupyter_output><empty_output><jupyter_text>It gives us an idea that the number of people Survived is around 300 and number of people died is around 500.<jupyter_code># Now lets take a look at exact numbers.

df.Survived.sum()<jupyter_output><empty_output><jupyter_text>Which means the number of people who couldn't survive = (891-342) = 549<jupyter_code># Lets see how Passenger's Class affected their Survival rate

df.groupby(['Survived','Pclass'])['Survived'].count()<jupyter_output><empty_output><jupyter_text>Shows us that Class 1 passengers had the least death rate.<jupyter_code># Making a lineplot to see if we could find something

sns.lineplot(x='Pclass',y='Survived',data=df)
# Now lets make a catplot

sns.catplot(x='Pclass',y='Survived',kind='point',data=df)
# Lets see how passenger's Sex affected their Survival rate.

df.groupby(['Survived','Sex'])['Survived'].count()<jupyter_output><empty_output><jupyter_text>It shows us Females had a higher chance of staying alive.<jupyter_code># Lets Make a countplot to visualize this 

sns.countplot(x='Survived',hue='Sex',data=df)
# Lets visualize this with Violin Plot aswell

sns.violinplot(x='Survived',y='Sex',data=df)<jupyter_output><empty_output><jupyter_text>So the conclusion is Female had higher chances of Surviving than men.<jupyter_code># Now lets see how Passenger's Embarked Status affected survival rate

sns.catplot(x='Survived',col='Embarked',kind='count',data=df)
# Visualizing again with catplot, point kind.

sns.catplot(x='Embarked',y='Survived',kind='point',data=df)<jupyter_output><empty_output><jupyter_text>It shows passengers with Embarked 'S' had the most death rate and Embarked 'C' had the least death rate.<jupyter_code># Lets take a look at the age variations in dataset

df['Age'].hist(bins=20)
# Visualizing age of the passengers based on Sex

sns.violinplot(x='Sex',y='Age',data=df)<jupyter_output><empty_output><jupyter_text>(But I did this after putting the mean values in Null values so technically most of the people should be ~25 yrs old)<jupyter_code># Lets make a countplot to visualize Siblings and Spouses in the data

sns.countplot(x='SibSp',data=df)
# Lets make a histogram to visualize Ticket Fares

df['Fare'].hist(bins=40)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10197368421052631, 'fraction_numerical': 0.01644736842105263, 'mean_word_length': 6.684115523465704, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, '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': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '602596', 'license': 'MIT', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1415, 'n_words': 450, 'path': 'Titanic_EDA/.ipynb_checkpoints/Titanic_Codechef-checkpoint.ipynb', 'repo_name': 'mekken2/EDA-Squad', 'size': '4256'}