Big Data Analysis with Python
Combine Spark and Python to unlock the powers of parallel computing and machine learning
Ivan Marin, Ankit Shukla, Sarang VK
- 276 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Big Data Analysis with Python
Combine Spark and Python to unlock the powers of parallel computing and machine learning
Ivan Marin, Ankit Shukla, Sarang VK
About This Book
Get to grips with processing large volumes of data and presenting it as engaging, interactive insights using Spark and Python.
Key Features
- Get a hands-on, fast-paced introduction to the Python data science stack
- Explore ways to create useful metrics and statistics from large datasets
- Create detailed analysis reports with real-world data
Book Description
Processing big data in real time is challenging due to scalability, information inconsistency, and fault tolerance. Big Data Analysis with Python teaches you how to use tools that can control this data avalanche for you. With this book, you'll learn practical techniques to aggregate data into useful dimensions for posterior analysis, extract statistical measurements, and transform datasets into features for other systems.
The book begins with an introduction to data manipulation in Python using pandas. You'll then get familiar with statistical analysis and plotting techniques. With multiple hands-on activities in store, you'll be able to analyze data that is distributed on several computers by using Dask. As you progress, you'll study how to aggregate data for plots when the entire data cannot be accommodated in memory. You'll also explore Hadoop (HDFS and YARN), which will help you tackle larger datasets. The book also covers Spark and explains how it interacts with other tools.
By the end of this book, you'll be able to bootstrap your own Python environment, process large files, and manipulate data to generate statistics, metrics, and graphs.
What you will learn
- Use Python to read and transform data into different formats
- Generate basic statistics and metrics using data on disk
- Work with computing tasks distributed over a cluster
- Convert data from various sources into storage or querying formats
- Prepare data for statistical analysis, visualization, and machine learning
- Present data in the form of effective visuals
Who this book is for
Big Data Analysis with Python is designed for Python developers, data analysts, and data scientists who want to get hands-on with methods to control data and transform it into impactful insights. Basic knowledge of statistical measurements and relational databases will help you to understand various concepts explained in this book.
Frequently asked questions
Information
Chapter 1
The Python Data Science Stack
Learning Objectives
- Use all components of the Python data science stack
- Manipulate data using pandas DataFrames
- Create simple plots using pandas and Matplotlib
Introduction
Python Libraries and Packages
- NumPy: A numerical manipulation package
- pandas: A data manipulation and analysis library
- SciPy library: A collection of mathematical algorithms built on top of NumPy
- Matplotlib: A plotting and graph library
- IPython: An interactive Python shell
- Jupyter notebook: A web document application for interactive computing
IPython: A Powerful Interactive Shell
- Input history that is available between sessions, so when you restart your shell, the previous commands that you typed can be reused.
- Using Tab completion for commands and variables, you can type the first letters of a Python command, function, or variable and IPython will autocomplete it.
- Magic commands that extend the functionality of the shell. Magic functions can enhance IPython functionality, such as adding a module that can reload imported modules after they are changed in the disk, without having to restart IPython.
- Syntax highlighting.
Exercise 1: Interacting with the Python Shell Using the IPython Commands
- To start the Python shell, type the ipython command in the console:> ipythonIn [1]:The IPython shell is now ready and waiting for further commands. First, let's do a simple exercise to solve a sorting problem with one of the basic sorting methods, called straight insertion.
- In the IPython shell, copy-paste the following code:import numpy as npvec = np.random.randint(0, 100, size=5)print(vec)Now, the output for the randomly generated numbers will be similar to the following:[23, 66, 12, 54, 98, 3]
- Use the following logic to print the elements of the vec array in ascending order:for j in np.arange(1, vec.size):v = vec[j]i = jwhile i > 0 and vec[i-1] > v:vec[i] = vec[i-1]i = i - 1vec[i] = vUse the print(vec) command to print the output on the console:[3, 12, 23, 54, 66, 98]
- Now modify the code. Instead of creating an array of 5 elements, change its parameters so it creates an array with 20 elements, using the up arrow to edit the pasted code. After changing the relevant section, use the down arrow to move to the end of the code and press Enter to execute it.