23,99 €
Get to grips with the most popular Python packages that make data analysis possible
Python, a multi-paradigm programming language, has become the language of choice for data scientists for visualization, data analysis, and machine learning.
Hands-On Data Analysis with NumPy and Pandas starts by guiding you in setting up the right environment for data analysis with Python, along with helping you install the correct Python distribution. In addition to this, you will work with the Jupyter notebook and set up a database. Once you have covered Jupyter, you will dig deep into Python’s NumPy package, a powerful extension with advanced mathematical functions. You will then move on to creating NumPy arrays and employing different array methods and functions. You will explore Python’s pandas extension which will help you get to grips with data mining and learn to subset your data. Last but not the least you will grasp how to manage your datasets by sorting and ranking them.
By the end of this book, you will have learned to index and group your data for sophisticated data analysis and manipulation.
Hands-On Data Analysis with NumPy and Pandas is for you if you are a Python developer and want to take your first steps into the world of data analysis. No previous experience of data analysis is required to enjoy this book.
Curtis Miller is a graduate student at the University of Utah, seeking an Master’s in Statistics (MSTAT) and a Big Data Certificate. In the past, Curtis has worked as a Math Tutor, and has a double major adding mathematics with an emphasis in statistics as a second major. Curtis has studied the gender pay gap, and presented his paper or Gender Pay Disparity in Utah, which grabbed the attention of local media outlets. He currently teaches Basic Statistics at the University of Utah. He enjoys writing and is an avid reader, and enjoys studying politics, economics, history, and psychology and sociology.Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 113
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor:Sunith ShettyAcquisition Editor:Tushar GuptaContent Development Editor:Prasad RameshTechnical Editor: Sagar SawantCopy Editor: Vikrant PhadkeProject Coordinator: Nidhi JoshiProofreader: Safis EditingIndexer: Rekha NairGraphics:Jisha ChirayilProduction Coordinator:Shraddha Falebhai
First published: June 2016
Production reference: 1280618
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78953-079-7
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Curtis Miller is a graduate student at the University of Utah, seeking a master's in statistics (MSTAT) and a big data certificate. He was a math tutor and has a double major in mathematics, with an emphasis on statistics as a second major.
He has studied the gender pay gap, and presented his paper on Gender Pay Disparity in Utah, which grabbed the attention of local media outlets.
He currently teaches basic statistics at the University of Utah. He enjoys writing and is an avid reader. He also enjoys studying politics, economics, history, psychology, and sociology.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Hands-On Data Analysis with NumPy and pandas
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Setting Up a Python Data Analysis Environment
What is Anaconda?
Installing Anaconda
Exploring Jupyter Notebooks
Exploring alternatives to Jupyter
Spyder
Rodeo
ptpython
Package management with Conda
What is Conda?
Conda environment management
Managing Python
Package management
Setting up a database
Installing MySQL
MySQL connectors
Creating a database
Summary
Diving into NumPY
NumPy arrays
Special numeric values
Creating NumPy arrays
Creating ndarray
Summary
Operations on NumPy Arrays
Selecting elements explicitly
Slicing arrays with colons
Advanced indexing
Expanding arrays
Arithmetic and linear algebra with arrays
Arithmetic with two equal-shaped arrays
Broadcasting
Linear algebra
Employing array methods and functions
Array methods
Vectorization with ufuncs
Custom ufuncs
Summary
pandas are Fun! What is pandas?
What does pandas do?
Exploring series and DataFrame objects
Creating series
Creating DataFrames
Adding data
Saving DataFrames
Subsetting your data
Subsetting a series
Indexing methods
Slicing a DataFrame
Summary
Arithmetic, Function Application, and Mapping with pandas
Arithmetic
Arithmetic with DataFrames
Vectorization with DataFrames
DataFrame function application
Handling missing data in a pandas DataFrame
Deleting missing information
Filling missing information
Summary
Managing, Indexing, and Plotting
Index sorting
Sorting by values
Hierarchical indexing
Slicing a series with a hierarchical index
Plotting with pandas
Plotting methods
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
Python, a multi-paradigm programming language, has become the language of choice for data scientists for data analysis, visualization, and machine learning.
You will start off by learning how to set up the right environment for data analysis with Python. Here, you'll learn to install the right Python distribution, as well as work with the Jupyter notebook and set up a database. After that, you will dive into Python's NumPy package—Python's powerful extension with advanced mathematical functions. You will learn to create NumPy arrays, as well as employ different array methods and functions. Then, you will explore Python's pandas extension, where you will learn to subset your data, as well as dive into data mapping using pandas. You'll also learn to manage your datasets by sorting and ranking them.
By the end of this book, you will learn to index and group your data for sophisticated data analysis and manipulation.
If you are a Python developer and want to take your first steps into the world of data analysis, then this is the book you have been waiting for!
Chapter 1, Setting Up a Python Data Analysis Environment, discusses installing Anaconda and managing it. Anaconda is a software package we will use in the following chapters of this book.
Chapter 2, Diving into NumPY, discusses NumPy data types controlled by dtype objects, which are the way NumPy stores and manages data.
Chapter 3, Operations on NumPy Arrays, will cover what every NumPy user should know about array slicing, arithmetic, linear algebra with arrays, and employing array methods and functions.
Chapter 4, pandas are Fun! What is pandas?, introduces pandas and looks at what it does. We explore pandas series, DataFrames, and creating them.
Chapter 5, Arithmetic, Function Application, and Mapping with pandas, revisits some topics discussed previously, regarding applying functions in arithmetic to a multivariate object and handling missing data in pandas.
Chapter 6, Managing, Indexing, and Plotting, looks at sorting and ranking. We'll see how to achieve this in pandas, looking at hierarchical indexing and plotting with pandas.
Python 3.4.x or newer. On Debian and derivatives (Ubuntu): python, python-dev, or python3-dev. On Windows: The official python installer at www.python.org is enough:
NumPy
pandas
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Data-Analysis-with-NumPy-and-pandas. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Then with this sign, I multiply this array with arr1."
Any command-line input or output is written as follows:
conda install selenium
Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Here we add monotype and then click on Run cell again."
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
In this chapter, we will cover the following topics:
Installing Anaconda
Exploring Jupyter Notebooks
Exploring an alternative to Jupyter
Managing the Anaconda package
Setting up a database
In this chapter, we'll discuss installing Anaconda and managing it. Anaconda is a software package we will use in the following chapters of this book.
In this section, we will discuss what Anaconda is and why we use it. We'll provide a link to show where to download Anaconda from the website of its sponsor, Continuum Analytics, and discuss how to install Anaconda. Anaconda is an open source distribution of the Python and R programming languages.
In this book, we'll focus on the portion of Anaconda devoted to Python. Anaconda helps us use these languages for data analysis applications, including large-scale data processing, predictive analytics, and scientific and statistical computing. Continuum Analytics provides enterprise support for Anaconda, including versions that help teams collaborate and boost the performance of their systems, along with providing a means for deploying models developed using Anaconda. Thus, Anaconda appears in enterprise settings, and aspiring analysts should be familiar with its use. Many of the packages used in this book, including Jupyter, NumPy, pandas, and many others common in data analysis, are included with Anaconda. This alone may explain its popularity.
An Anaconda installation includes most of what you need for data analysis out of the box. The Conda package manager can be used to download and installation new packages as well.
One can download Anaconda for free from the Continuum Analytics website. The link to the main download page is https://www.anaconda.com/download/
