<jupyter_start><jupyter_text>Visualizing the Titanic Disaster  Introduction:This exercise is based on the titanic Disaster dataset avaiable at [Kaggle](https://www.kaggle.com/c/titanic).  To know more about the variables check [here](https://www.kaggle.com/c/titanic/data) Step 1. Import the necessary libraries<jupyter_code>import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/07_Visualization/Titanic_Desaster/train.csv)  Step 3. Assign it to a variable titanic<jupyter_code>titanic = pd.read_csv("https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/07_Visualization/Titanic_Desaster/train.csv")<jupyter_output><empty_output><jupyter_text>Step 4. Set PassengerId as the index<jupyter_code>titanic = titanic.set_index("PassengerId")
titanic.head()<jupyter_output><empty_output><jupyter_text>Step 5. Create a pie chart presenting the male/female proportion<jupyter_code>#titanic.plot?
titanic.Sex.value_counts().plot(kind='pie', autopct='%1.2f%%', shadow=True, fontsize=14)

#df.plot(kind='pie', y = 'total_arrests', ax=ax1, autopct='%1.1f%%', 
# startangle=90, shadow=False, labels=df['officer_name'], legend = False, fontsize=14)<jupyter_output><empty_output><jupyter_text>Step 6. Create a scatterplot with the Fare payed and the Age, differ the plot color by gender<jupyter_code>#sns.scatterplot(data=titanic, x="Age", y="Fare", hue="Sex")

lm = sns.lmplot(data=titanic, x="Age", y="Fare", hue="Sex", fit_reg=False, palette=)

lm.set(title="Age vs Fare")<jupyter_output><empty_output><jupyter_text>Step 7. How many people survived?<jupyter_code>titanic["Survived"].value_counts()<jupyter_output><empty_output><jupyter_text>Step 8. Create a histogram with the Fare payed<jupyter_code>#sns.distplot?
sns.distplot(titanic["Fare"])<jupyter_output><empty_output><jupyter_text>BONUS: Create your own question and answer it.<jupyter_code>sns.catplot(x="Sex", y="Survived", hue="Pclass", kind="bar", data=titanic)
#sns.catplot(x="Fare", y="Survived", hue="Pclass", kind="bar", data=titanic)
sns.catplot(x="Sex", y="Fare", hue="Survived", kind="bar", data=titanic)
sns.pairplot(data=titanic, hue="Sex")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1432192648922687, 'fraction_numerical': 0.009716941275876637, 'mean_word_length': 8.704918032786885, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '594873', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 929, 'n_tokens_neox': 891, 'n_words': 164, 'path': '07_Visualization/Titanic_Desaster/Exercises.ipynb', 'repo_name': 'MichalGasiorowski/pandas_exercises', 'size': '2367'}