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
Free Trial
Paperback Nov 2017 204 pages 1st Edition
eBook
Mex$378.99 Mex$541.99
Paperback
Mex$676.99
Subscription
Free Trial
Arrow left icon
Profile Icon Visochek
Arrow right icon
Free Trial
Paperback Nov 2017 204 pages 1st Edition
eBook
Mex$378.99 Mex$541.99
Paperback
Mex$676.99
Subscription
Free Trial
eBook
Mex$378.99 Mex$541.99
Paperback
Mex$676.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781787286139
Vendor :
RStudio
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Nov 15, 2017
Length: 204 pages
Edition : 1st
Language : English
ISBN-13 : 9781787286139
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 Mex$85 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 Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,482.97
Statistics for Data Science
Mex$902.99
Practical Data Wrangling
Mex$676.99
Python Machine Learning, Second Edition
Mex$902.99
Total Mex$ 2,482.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.