Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo
Getting Started with Python Data Analysis

Book Description

Learn to use powerful Python libraries for effective data processing and analysis

About This Book

  • Learn the basic processing steps in data analysis and how to use Python in this area through supported packages, especially Numpy, Pandas, and Matplotlib

  • Create, manipulate, and analyze your data to extract useful information to optimize your system

  • A hands-on guide to help you learn data analysis using Python

  • Who This Book Is For

    If you are a Python developer who wants to get started with data analysis and you need a quick introductory guide to the python data analysis libraries, then this book is for you.

    What You Will Learn

  • Understand the importance of data analysis and get familiar with its processing steps

  • Get acquainted with Numpy to use with arrays and array-oriented computing in data analysis

  • Create effective visualizations to present your data using Matplotlib

  • Process and analyze data using the time series capabilities of Pandas

  • Interact with different kind of database systems, such as file, disk format, Mongo, and Redis

  • Apply the supported Python package to data analysis applications through examples

  • Explore predictive analytics and machine learning algorithms using Scikit-learn, a Python library

  • In Detail

    Data analysis is the process of applying logical and analytical reasoning to study each component of data. Python is a multi-domain, high-level, programming language. It’s often used as a scripting language because of its forgiving syntax and operability with a wide variety of different eco-systems. Python has powerful standard libraries or toolkits such as Pylearn2 and Hebel, which offers a fast, reliable, cross-platform environment for data analysis.

    With this book, we will get you started with Python data analysis and show you what its advantages are.

    The book starts by introducing the principles of data analysis and supported libraries, along with NumPy basics for statistic and data processing. Next it provides an overview of the Pandas package and uses its powerful features to solve data processing problems.

    Moving on, the book takes you through a brief overview of the Matplotlib API and some common plotting functions for DataFrame such as plot. Next, it will teach you to manipulate the time and data structure, and load and store data in a file or database using Python packages. The book will also teach you how to apply powerful packages in Python to process raw data into pure and helpful data using examples.

    Finally, the book gives you a brief overview of machine learning algorithms, that is, applying data analysis results to make decisions or build helpful products, such as recommendations and predictions using scikit-learn.

    Style and approach

    This is an easy-to-follow, step-by-step guide to get you familiar with data analysis and the libraries supported by Python. Topics are explained with real-world examples wherever required.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Getting Started with Python Data Analysis
      1. Table of Contents
      2. Getting Started with Python Data Analysis
      3. Credits
      4. About the Authors
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Introducing Data Analysis and Libraries
        1. Data analysis and processing
        2. An overview of the libraries in data analysis
        3. Python libraries in data analysis
          1. NumPy
          2. Pandas
          3. Matplotlib
          4. PyMongo
          5. The scikit-learn library
        4. Summary
      9. 2. NumPy Arrays and Vectorized Computation
        1. NumPy arrays
          1. Data types
          2. Array creation
          3. Indexing and slicing
          4. Fancy indexing
          5. Numerical operations on arrays
        2. Array functions
        3. Data processing using arrays
          1. Loading and saving data
          2. Saving an array
          3. Loading an array
        4. Linear algebra with NumPy
        5. NumPy random numbers
        6. Summary
      10. 3. Data Analysis with Pandas
        1. An overview of the Pandas package
        2. The Pandas data structure
          1. Series
          2. The DataFrame
        3. The essential basic functionality
          1. Reindexing and altering labels
          2. Head and tail
          3. Binary operations
          4. Functional statistics
          5. Function application
          6. Sorting
        4. Indexing and selecting data
        5. Computational tools
        6. Working with missing data
        7. Advanced uses of Pandas for data analysis
          1. Hierarchical indexing
          2. The Panel data
        8. Summary
      11. 4. Data Visualization
        1. The matplotlib API primer
          1. Line properties
          2. Figures and subplots
        2. Exploring plot types
          1. Scatter plots
          2. Bar plots
          3. Contour plots
          4. Histogram plots
        3. Legends and annotations
        4. Plotting functions with Pandas
        5. Additional Python data visualization tools
          1. Bokeh
          2. MayaVi
        6. Summary
      12. 5. Time Series
        1. Time series primer
        2. Working with date and time objects
        3. Resampling time series
        4. Downsampling time series data
        5. Upsampling time series data
        6. Time zone handling
        7. Timedeltas
        8. Time series plotting
        9. Summary
      13. 6. Interacting with Databases
        1. Interacting with data in text format
          1. Reading data from text format
          2. Writing data to text format
        2. Interacting with data in binary format
          1. HDF5
        3. Interacting with data in MongoDB
        4. Interacting with data in Redis
          1. The simple value
          2. List
          3. Set
          4. Ordered set
        5. Summary
      14. 7. Data Analysis Application Examples
        1. Data munging
          1. Cleaning data
          2. Filtering
          3. Merging data
          4. Reshaping data
        2. Data aggregation
        3. Grouping data
        4. Summary
      15. 8. Machine Learning Models with scikit-learn
        1. An overview of machine learning models
        2. The scikit-learn modules for different models
        3. Data representation in scikit-learn
        4. Supervised learning – classification and regression
        5. Unsupervised learning – clustering and dimensionality reduction
        6. Measuring prediction performance
        7. Summary
      16. Index