Data Analysis On Titanic Dataset


In this project, I explored the classic Titanic dataset to understand passenger survival patterns using data visualization and built a machine learning model to predict survival chances. This project demonstrates key data analysis skills, including data cleaning, visualization, feature engineering, and predictive modeling.

Dataset & Tools
  • Dataset: Titanic Dataset (Kaggle)

  • Tools: Python, Pandas, Matplotlib, Seaborn, Scikit-learn

  • Skills Demonstrated:

    • Data Cleaning & Exploration, Visualization & Insight Discovery, 

                    Predictive Modeling (Logistic Regression)

A Small Example for Graphs and Importing Pandas

import pandas as pd

# Time Series ;  Time Stamped data;

# ex. weather data (temp), stock prices; gold price,    -> line plot



We start by importing and cleaning the dataset: 
titanic_df.head()

A Simple plot to look at the data of people who died and survived the crash 
# Seabon.countplot  -- for categorical data

# Plot the Number of passengers Survived and didn't ...

sns.countplot(x='Survived',data=titanic_df)
plt.title('Passenger Information')
plt.xlabel('0=Died 1=Survived')
plt.ylabel('Total number of Passengers')
plt.show() 

A plot to show the passenger survived on gender wise
# Plot the Number of passengers Survived and didn't ...

sns.countplot(x='Survived',hue='Pclass',data=titanic_df)
plt.title('Passenger Information Genderwise Survival')
plt.xlabel('0=Died 1=Survived')

plt.ylabel('Total number of Passengers')
plt.show()

A plot to show each side by side for better understanding on passenger survived by class and gender
# Display two plots on the same figure (canvas)
#  Figure --> Axes (akseez) --> Axis (akis; x,y)

fig = plt.figure(figsize=(10,6))
# define two axes
ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(122)
   
sns.countplot(x='Survived',hue='Pclass',data=titanic_df,ax=ax1)
sns.countplot(x='Survived',hue='Sex',data=titanic_df,ax=ax2)
# titlle
#plt.title('Passengers info')
ax1.set_title('Passengers Information ClassWise')
ax2.set_title('Passengers Information GenderWise')
ax1.set_xlabel('Classes')
ax2.set_xlabel('Genders')

ax1.set_ylabel('Number of passengers')

plt.show()




Comments

Popular posts from this blog

Coffee Sales Dashboard with Power BI: Daily Trends, Top Flavors, and Peak Hours Analysis

Data science blog