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
Applied Data Science with Python and Jupyter

You're reading from   Applied Data Science with Python and Jupyter Use powerful industry-standard tools to unlock new, actionable insights from your data

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher
ISBN-13 9781789958171
Length 192 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Alex Galea Alex Galea
Author Profile Icon Alex Galea
Alex Galea
Arrow right icon
View More author details
Toc

Chapter 2: Data Cleaning and Advanced Machine

Activity 2: Preparing to Train a Predictive Model for the Employee-Retention Problem

  1. Scroll to the Activity A section of the lesson-2-workbook.ipynb notebook file.
  2. Check the head of the table by running the following code:
    %%bash
    head ../data/hr-analytics/hr_data.csv

    Judging by the output, convince yourself that it looks to be in standard CSV format. For CSV files, we should be able to simply load the data with pd.read_csv.

  3. Load the data with Pandas by running df = pd.read_csv('../data/hr- analytics/hr_data.csv'). Write it out yourself and use tab completion to help type the file path.
  4. Inspect the columns by printing df.columns and make sure the data has loaded as expected by printing the DataFrame head and tail with df.head() and df.tail():
    Figure 2.46: Output for inspecting head and tail of columns
    Figure 2.46: Output for inspecting head and tail of columns

    We can see that it appears to have loaded correctly. Based on the tail index values, there are nearly 15,000 rows...

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