1. Fundamentals
Activity 1.01: Implementing Pandas Functions
- Open a new Jupyter notebook.
- Use
pandas
to load the Titanic dataset:import pandas as pd df = pd.read_csv(r'../Datasets/titanic.csv')
- Use the
head
function on the dataset as follows:# Have a look at the first 5 sample of the data df.head()
The output will be as follows:
- Use the
describe
function as follows:df.describe(include='all')
The output will be as follows:
- We do not need the
Unnamed: 0
column. We can remove the column without using thedel
command, as follows:del df['Unnamed: 0'] df = df[df.columns[1:]] # Use the columns df.head()
The output will be as follows:
- Compute the mean, standard deviation, minimum, and maximum values for the columns of the DataFrame without using
describe
:df.mean()
The output will be as follows: