Python Data Analysis - Second Edition

Book description

Learn how to apply powerful data analysis techniques with popular open source Python modules

About This Book

  • Find, manipulate, and analyze your data using the Python 3.5 libraries
  • Perform advanced, high-performance linear algebra and mathematical calculations with clean and efficient Python code
  • An easy-to-follow guide with realistic examples that are frequently used in real-world data analysis projects.

Who This Book Is For

This book is for programmers, scientists, and engineers who have the knowledge of Python and know the basics of data science. It is for those who wish to learn different data analysis methods using Python 3.5 and its libraries. This book contains all the basic ingredients you need to become an expert data analyst.

What You Will Learn

  • Install open source Python modules such NumPy, SciPy, Pandas, stasmodels, scikit-learn,theano, keras, and tensorflow on various platforms
  • Prepare and clean your data, and use it for exploratory analysis
  • Manipulate your data with Pandas
  • Retrieve and store your data from RDBMS, NoSQL, and distributed filesystems such as HDFS and HDF5
  • Visualize your data with open source libraries such as matplotlib, bokeh, and plotly
  • Learn about various machine learning methods such as supervised, unsupervised, probabilistic, and Bayesian
  • Understand signal processing and time series data analysis
  • Get to grips with graph processing and social network analysis

In Detail

Data analysis techniques generate useful insights from small and large volumes of data. Python, with its strong set of libraries, has become a popular platform to conduct various data analysis and predictive modeling tasks.

With this book, you will learn how to process and manipulate data with Python for complex analysis and modeling. We learn data manipulations such as aggregating, concatenating, appending, cleaning, and handling missing values, with NumPy and Pandas. The book covers how to store and retrieve data from various data sources such as SQL and NoSQL, CSV fies, and HDF5. We learn how to visualize data using visualization libraries, along with advanced topics such as signal processing, time series, textual data analysis, machine learning, and social media analysis.

The book covers a plethora of Python modules, such as matplotlib, statsmodels, scikit-learn, and NLTK. It also covers using Python with external environments such as R, Fortran, C/C++, and Boost libraries.

Style and approach

The book takes a very comprehensive approach to enhance your understanding of data analysis. Sufficient real-world examples and use cases are included in the book to help you grasp the concepts quickly and apply them easily in your day-to-day work. Packed with clear, easy to follow examples, this book will turn you into an ace data analyst in no time.

Table of contents

  1. Python Data Analysis - Second Edition
    1. Python Data Analysis - Second Edition
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    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. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with Python Libraries
      1. Installing Python 3
        1. Installing data analysis libraries
        2. On Linux or Mac OS X
        3. On Windows
      2. Using IPython as a shell
      3. Reading manual pages
      4. Jupyter Notebook
      5. NumPy arrays
      6. A simple application
      7. Where to find help and references
      8. Listing modules inside the Python libraries
      9. Visualizing data using Matplotlib
      10. Summary
    9. 2. NumPy Arrays
      1. The NumPy array object
        1. Advantages of NumPy arrays
      2. Creating a multidimensional array
      3. Selecting NumPy array elements
      4. NumPy numerical types
        1. Data type objects
        2. Character codes
        3. The dtype constructors
        4. The dtype attributes
      5. One-dimensional slicing and indexing
      6. Manipulating array shapes
        1. Stacking arrays
        2. Splitting NumPy arrays
        3. NumPy array attributes
        4. Converting arrays
      7. Creating array views and copies
      8. Fancy indexing
      9. Indexing with a list of locations
      10. Indexing NumPy arrays with Booleans
      11. Broadcasting NumPy arrays
      12. Summary
      13. References
    10. 3. The Pandas Primer
      1. Installing and exploring Pandas
      2. The Pandas DataFrames
      3. The Pandas Series
      4. Querying data in Pandas
      5. Statistics with Pandas DataFrames
      6. Data aggregation with Pandas DataFrames
      7. Concatenating and appending DataFrames
      8. Joining DataFrames
      9. Handling missing values
      10. Dealing with dates
      11. Pivot tables
      12. Summary
      13. References
    11. 4. Statistics and Linear Algebra
      1. Basic descriptive statistics with NumPy
      2. Linear algebra with NumPy
        1. Inverting matrices with NumPy
        2. Solving linear systems with NumPy
      3. Finding eigenvalues and eigenvectors with NumPy
      4. NumPy random numbers
        1. Gambling with the binomial distribution
        2. Sampling the normal distribution
        3. Performing a normality test with SciPy
      5. Creating a NumPy masked array
        1. Disregarding negative and extreme values
      6. Summary
    12. 5. Retrieving, Processing, and Storing Data
      1. Writing CSV files with NumPy and Pandas
      2. The binary .npy and pickle formats
      3. Storing data with PyTables
      4. Reading and writing Pandas DataFrames to HDF5 stores
      5. Reading and writing to Excel with Pandas
      6. Using REST web services and JSON
      7. Reading and writing JSON with Pandas
      8. Parsing RSS and Atom feeds
      9. Parsing HTML with Beautiful Soup
      10. Summary
      11. Reference
    13. 6. Data Visualization
      1. The matplotlib subpackages
      2. Basic matplotlib plots
      3. Logarithmic plots
      4. Scatter plots
      5. Legends and annotations
      6. Three-dimensional plots
      7. Plotting in Pandas
      8. Lag plots
      9. Autocorrelation plots
      10. Plot.ly
      11. Summary
    14. 7. Signal Processing and Time Series
      1. The statsmodels modules
      2. Moving averages
      3. Window functions
      4. Defining cointegration
      5. Autocorrelation
      6. Autoregressive models
      7. ARMA models
      8. Generating periodic signals
      9. Fourier analysis
      10. Spectral analysis
      11. Filtering
      12. Summary
    15. 8. Working with Databases
      1. Lightweight access with sqlite3
      2. Accessing databases from Pandas
      3. SQLAlchemy
        1. Installing and setting up SQLAlchemy
        2. Populating a database with SQLAlchemy
        3. Querying the database with SQLAlchemy
      4. Pony ORM
      5. Dataset - databases for lazy people
      6. PyMongo and MongoDB
      7. Storing data in Redis
      8. Storing data in memcache
      9. Apache Cassandra
      10. Summary
    16. 9. Analyzing Textual Data and Social Media
      1. Installing NLTK
      2. About NLTK
      3. Filtering out stopwords, names, and numbers
      4. The bag-of-words model
      5. Analyzing word frequencies
      6. Naive Bayes classification
      7. Sentiment analysis
      8. Creating word clouds
      9. Social network analysis
      10. Summary
    17. 10. Predictive Analytics and Machine Learning
      1. Preprocessing
      2. Classification with logistic regression
      3. Classification with support vector machines
      4. Regression with ElasticNetCV
      5. Support vector regression
      6. Clustering with affinity propagation
      7. Mean shift
      8. Genetic algorithms
      9. Neural networks
      10. Decision trees
      11. Summary
    18. 11. Environments Outside the Python Ecosystem and Cloud Computing
      1. Exchanging information with Matlab/Octave
      2. Installing rpy2 package
      3. Interfacing with R
      4. Sending NumPy arrays to Java
      5. Integrating SWIG and NumPy
      6. Integrating Boost and Python
      7. Using Fortran code through f2py
      8. PythonAnywhere Cloud
      9. Summary
    19. 12. Performance Tuning, Profiling, and Concurrency
      1. Profiling the code
      2. Installing Cython
      3. Calling C code
      4. Creating a process pool with multiprocessing
      5. Speeding up embarrassingly parallel for loops with Joblib
      6. Comparing Bottleneck to NumPy functions
      7. Performing MapReduce with Jug
      8. Installing MPI for Python
      9. IPython Parallel
      10. Summary
    20. A. Key Concepts
    21. B. Useful Functions
      1. Matplotlib
      2. NumPy
      3. Pandas
      4. Scikit-learn
      5. SciPy
        1. scipy.fftpack
        2. scipy.signal
        3. scipy.stats
    22. C. Online Resources

Product information

  • Title: Python Data Analysis - Second Edition
  • Author(s): Armando Fandango
  • Release date: March 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787127487