Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Deep Learning with PyTorch Workshop

You're reading from   The Deep Learning with PyTorch Workshop Build deep neural networks and artificial intelligence applications with PyTorch

Arrow left icon
Product type Paperback
Published in Jul 2020
Publisher Packt
ISBN-13 9781838989217
Length 330 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Hyatt Saleh Hyatt Saleh
Author Profile Icon Hyatt Saleh
Hyatt Saleh
Arrow right icon
View More author details
Toc

2. Building Blocks of Neural Networks

Activity 2.01: Performing Data Preparation

Solution

  1. Import the required libraries:
    import pandas as pd
  2. Using pandas, load the .csv file:
    data = pd.read_csv("YearPredictionMSD.csv", nrows=50000)
    data.head()

    Note

    To avoid memory limitations, use the nrows argument when reading the text file in order to read a smaller section of the entire dataset. In the preceding example, we are reading the first 50,000 rows.

    The output is as follows:

    Figure 2.33: YearPredictionMSD.csv

  3. Verify whether any qualitative data is present in the dataset:
    cols = data.columns
    num_cols = data._get_numeric_data().columns
    list(set(cols) - set(num_cols))

    The output should be an empty list, meaning there are no qualitative features.

  4. Check for missing values.

    If you add an additional sum() function to the line of code that was previously used for this purpose, you will get the sum of missing values in the entire dataset, without discriminating by column...

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 $19.99/month. Cancel anytime
Banner background image