<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 seaborn as sns
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('train.csv')
titanic<jupyter_output><empty_output><jupyter_text>Step 4. Set PassengerId as the index<jupyter_code>titanic.set_index('PassengerId',inplace=True)<jupyter_output><empty_output><jupyter_text>Step 5. Create a pie chart presenting the male/female proportion<jupyter_code>sex = titanic['Sex'].value_counts()
sex.plot.pie(startangle = 90,autopct = '%1.1f%%',explode = (0.15 , 0))
plt.title("Sex Proportion")

# View the plot
plt.tight_layout()
plt.show()<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>titanic.plot.scatter(x='Fare',y='Age',c=titanic.Sex.map({'male':'b','female':'r'}))<jupyter_output><empty_output><jupyter_text>Step 7. How many people survived?<jupyter_code>titanic.Survived.sum()<jupyter_output><empty_output><jupyter_text>Step 8. Create a histogram with the Fare payed<jupyter_code>df = titanic.Fare.sort_values(ascending = False)
df.plot.hist(x='Fare',bins=60)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12522045855379188, 'fraction_numerical': 0.011757789535567314, 'mean_word_length': 8.053191489361701, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 3, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '533821', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 656, 'n_tokens_neox': 618, 'n_words': 119, 'path': '07_Visualization/Titanic_Desaster/Exercises.ipynb', 'repo_name': 'sakkahinori/pandas_exercises', 'size': '1701'}