Appendix

About

This section is included to assist the students to perform the activities in the book. It includes detailed steps that are to be performed by the students to achieve the objectives of the activities.

Chapter 1: Python Machine Learning Toolkit

Activity 1: pandas Functions

Solution

  1. Open a new Jupyter notebook.
  2. Use pandas to load the Titanic dataset:

    import pandas as pd

    df = pd.read_csv('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:

    Figure 1.65: First five rows
    Figure 1.65: First five rows

    Use the describe function as follows:

    df.describe(include='all') ...

Get Applied Supervised Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.