Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
The Pandas Workshop

You're reading from  The Pandas Workshop

Product type Book
Published in Jun 2022
Publisher Packt
ISBN-13 9781800208933
Pages 744 pages
Edition 1st Edition
Languages
Authors (4):
Blaine Bateman Blaine Bateman
Profile icon Blaine Bateman
Saikat Basak Saikat Basak
Profile icon Saikat Basak
Thomas V. Joseph Thomas V. Joseph
Profile icon Thomas V. Joseph
William So William So
Profile icon William So
View More author details

Table of Contents (21) Chapters

Preface Part 1 – Introduction to pandas
Chapter 1: Introduction to pandas Chapter 2: Working with Data Structures Chapter 3: Data I/O Chapter 4: Pandas Data Types Part 2 – Working with Data
Chapter 5: Data Selection – DataFrames Chapter 6: Data Selection – Series Chapter 7: Data Exploration and Transformation Chapter 8: Understanding Data Visualization Part 3 – Data Modeling
Chapter 9: Data Modeling – Preprocessing Chapter 10: Data Modeling – Modeling Basics Chapter 11: Data Modeling – Regression Modeling Part 4 – Additional Use Cases for pandas
Chapter 12: Using Time in pandas Chapter 13: Exploring Time Series Chapter 14: Applying pandas Data Processing for Case Studies Chapter 15: Appendix Other Books You May Enjoy

Solution 4.1

Perform the following steps to complete the activity:

  1. Open a new Jupyter notebook and select the Pandas_Workshop kernel.
  2. Import the pandas package:
    import pandas as pd
  3. Load the CSV file as a DataFrame:
    file_url = 'https://raw.githubusercontent.com/PacktWorkshops/The-Pandas-Workshop/master/Chapter04/Data/car.csv'
    data_frame = pd.read_csv(file_url)
  4. Display the first 10 rows of the DataFrame:
    data_frame.head(10)

The output will be as follows:

Figure 15.10 – Displaying the top 10 rows of the DataFrame

You can see some missing data (NaN) in a couple of columns. Displaying the DataFrame details with the info() function should help us to confirm this.

  1. Display the data types of each column in the DataFrame using the info() method:
    data_frame.info()

The output will be as follows:

Figure 15.11 – Displaying the full details of the DataFrame

As suspected, most columns have...

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 $15.99/month. Cancel anytime}