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
Practical Data Wrangling
Practical Data Wrangling

Practical Data Wrangling: Expert techniques for transforming your raw data into a valuable source for analytics

Arrow left icon
Profile Icon Visochek
Arrow right icon
$17.99 $25.99
eBook Nov 2017 204 pages 1st Edition
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Visochek
Arrow right icon
$17.99 $25.99
eBook Nov 2017 204 pages 1st Edition
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Practical Data Wrangling

Introduction to Programming in Python

Programming is a powerful tool for manipulating data because it gives you the ability to build your own custom tools for tackling non standard problems. Much of the content in this book will make use of the Python programming language, so in this chapter, I will give a brief introduction to programming in python. The chapter will include the following topics:

  • External resources
  • Logistical overview
  • Running programs in Python
  • Data types, variables, and the Python shell
  • Compound statements
  • Making comments within programs
  • A programmer's resources

If you are familiar with Python and general programming principals, you can comfortably skip ahead or skim through this chapter.

External resources

Not everything can fit in to this book and some material is subject to change. I've made a number of resources available on the internet including the following:

  • Installation instructions and guidelines
  • Datasets for the exercises in the chapters
  • Code from the exercises in the chapters
  • Links to documentation, further reading, and other useful resources

All external resources are available in a shared Google Drive folder at https://goo.gl/8S58ra.

Logistical overview

Each of the chapters will begin with a logistical overview, detailing the projects involved in the chapter, installation requirements, the file system setup for the projects and other useful details. These initial Logistical Overview sections will help you to get set up to follow along with the chapter.  

In this chapter, I will walk through the creation of one Python program called hello_world.py. I will walk through the steps of creating the python program at the beginning of the chapter.

I will also introduce an interface for executing python commands directly called the terminal. Using the terminal, I will demonstrate several elementary programming concepts. 

The finished product for the python program, as well as a program containing all of the terminal commands is available in the code folder of the external resources...

Running programs in python

A programming language is a set of syntactical rules to express instructions to the computer. These instructions are written in a computer program, a set of code that is stored in a static file in the file system of a computer.

In this section, you will make a simple program that prints the words Hello World! to the output. Completing this exercise will give you an introduction to the process of creating and running programs in Python.

Using text editors to write and manage programs

Like any other practice, programming requires a certain set of tools.

The first of these is the text editor. Text editors for programming are not like ordinary word processors, which...

Data types, variables, and the Python shell

In the next few sections, I will use a tool called the Python shell, which will help you get more comfortable using Python. The Python shell is a tool that allows the user to enter in Python commands, which get run instantaneously. This makes the Python shell a great place to quickly and easily experiment with small bits of code or new functionality in Python.

There is no easy way of saving the code that is entered in the Python shell, so it is best to use it only for experimentation.

You can run the Python shell from a Terminal. To do this, open a Terminal and, from any directory, enter one of the following depending on your configuration:

$ Python
$ python3

You should see a new command prompt within the Terminal that looks something like this:

In Python, a single instruction is called a simple statement. For now, each individual...

Compound statements

So far, each line of code that you have written gets executed exactly once and immediately after it is written. Compound statements are Python structures that allow you to control when and how certain pieces of code get executed. Compound statements significantly increase your expressiveness as a programmer. In other words, they allow you to do more with less code. Before introducing a few compound statements, it will be helpful to go over the syntactical structure.

Compound statement syntax and indentation level

A compound statement consists of two parts. The first part, the clause header, is a line containing the type of statement and some other information specific to the statement. The clause header...

External resources


Not everything can fit in to this book and some material is subject to change. I've made a number of resources available on the internet including the following:

  • Installation instructions and guidelines
  • Datasets for the exercises in the chapters
  • Code from the exercises in the chapters
  • Links to documentation, further reading, and other useful resources

All external resources are available in a shared Google Drive folder at https://goo.gl/8S58ra.

Logistical overview


Each of the chapters will begin with a logistical overview, detailing the projects involved in the chapter, installation requirements, the file system setup for the projects and other useful details. These initial Logistical Overview sections will help you to get set up to follow along with the chapter.  

In this chapter, I will walk through the creation of one Python program called hello_world.py. I will walk through the steps of creating the python program at the beginning of the chapter.

I will also introduce an interface for executing python commands directly called the terminal. Using the terminal, I will demonstrate several elementary programming concepts. 

The finished product for the python program, as well as a program containing all of the terminal commands is available in the code folder of the external resources at https://goo.gl/8S58ra.

Installation requirements

For this chapter, you will need the following:

  • Atom, an open source text editor created by GitHub
  • The...

Running programs in python


A programming language is a set of syntactical rules to express instructions to the computer. These instructions are written in a computer program, a set of code that is stored in a static file in the file system of a computer.

In this section, you will make a simple program that prints the words Hello World! to the output. Completing this exercise will give you an introduction to the process of creating and running programs in Python.

Using text editors to write and manage programs

Like any other practice, programming requires a certain set of tools.

The first of these is the text editor. Text editors for programming are not like ordinary word processors, which will often apply formatting to text and sometimes force users to save with certain file extensions. Programs need to be saved in a raw format in order to run properly. This can be done with plain text editors such as Notepad in Windows and gedit in Linux; however, there are a few reasons to use a specialized...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • ? This easy-to-follow guide takes you through every step of the data wrangling process in the best possible way
  • ? Work with different types of datasets, and reshape the layout of your data to make it easier for analysis
  • ? Get simple examples and real-life data wrangling solutions for data pre-processing

Description

Around 80% of time in data analysis is spent on cleaning and preparing data for analysis. This is, however, an important task, and is a prerequisite to the rest of the data analysis workflow, including visualization, analysis and reporting. Python and R are considered a popular choice of tool for data analysis, and have packages that can be best used to manipulate different kinds of data, as per your requirements. This book will show you the different data wrangling techniques, and how you can leverage the power of Python and R packages to implement them. You’ll start by understanding the data wrangling process and get a solid foundation to work with different types of data. You’ll work with different data structures and acquire and parse data from various locations. You’ll also see how to reshape the layout of data and manipulate, summarize, and join data sets. Finally, we conclude with a quick primer on accessing and processing data from databases, conducting data exploration, and storing and retrieving data quickly using databases. The book includes practical examples on each of these points using simple and real-world data sets to give you an easier understanding. By the end of the book, you’ll have a thorough understanding of all the data wrangling concepts and how to implement them in the best possible way.

Who is this book for?

If you are a data scientist, data analyst, or a statistician who wants to learn how to wrangle your data for analysis in the best possible manner, this book is for you. As this book covers both R and Python, some understanding of them will be beneficial.

What you will learn

  • ? Read a csv file into python and R, and print out some statistics on the data
  • ? Gain knowledge of the data formats and programming structures involved in retrieving API data
  • ? Make effective use of regular expressions in the data wrangling process
  • ? Explore the tools and packages available to prepare numerical data for analysis
  • ? Find out how to have better control over manipulating the structure of the data
  • ? Create a dexterity to programmatically read, audit, correct, and shape data
  • ? Write and complete programs to take in, format, and output data sets

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 15, 2017
Length: 204 pages
Edition : 1st
Language : English
ISBN-13 : 9781787283671
Vendor :
RStudio
Category :
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 15, 2017
Length: 204 pages
Edition : 1st
Language : English
ISBN-13 : 9781787283671
Vendor :
RStudio
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 120.97
Statistics for Data Science
$43.99
Practical Data Wrangling
$32.99
Python Machine Learning, Second Edition
$43.99
Total $ 120.97 Stars icon
Banner background image

Table of Contents

9 Chapters
Programming with Data Chevron down icon Chevron up icon
Introduction to Programming in Python Chevron down icon Chevron up icon
Reading, Exploring, and Modifying Data - Part I Chevron down icon Chevron up icon
Reading, Exploring, and Modifying Data - Part II Chevron down icon Chevron up icon
Manipulating Text Data - An Introduction to Regular Expressions Chevron down icon Chevron up icon
Cleaning Numerical Data - An Introduction to R and RStudio Chevron down icon Chevron up icon
Simplifying Data Manipulation with dplyr Chevron down icon Chevron up icon
Getting Data from the Web Chevron down icon Chevron up icon
Working with Large Datasets Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.