Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Supervised Learning Workshop - Second Edition

You're reading from  The Supervised Learning Workshop - Second Edition

Product type Book
Published in Feb 2020
Publisher Packt
ISBN-13 9781800209046
Pages 532 pages
Edition 2nd Edition
Languages
Authors (4):
Blaine Bateman Blaine Bateman
Profile icon Blaine Bateman
Ashish Ranjan Jha Ashish Ranjan Jha
Profile icon Ashish Ranjan Jha
Benjamin Johnston Benjamin Johnston
Profile icon Benjamin Johnston
Ishita Mathur Ishita Mathur
Profile icon Ishita Mathur
View More author details
Toc

1. Fundamentals

Activity 1.01: Implementing Pandas Functions

  1. Open a new Jupyter notebook.
  2. Use pandas to load the Titanic dataset:
    import pandas as pd
    df = pd.read_csv(r'../Datasets/titanic.csv')
  3. 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:

    Figure 1.26: First five rows

  4. Use the describe function as follows:
    df.describe(include='all')

    The output will be as follows:

    Figure 1.27: Output of describe()

  5. We do not need the Unnamed: 0 column. We can remove the column without using the del command, as follows:
    del df['Unnamed: 0']
    df = df[df.columns[1:]] # Use the columns
    df.head()

    The output will be as follows:

    Figure 1.28: First five rows after deleting the Unnamed: 0 column

  6. 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:

    Figure 1.29: Output...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime