Book Image

Learning pandas - Second Edition

By : Michael Heydt
Book Image

Learning pandas - Second Edition

By: Michael Heydt

Overview of this book

You will learn how to use pandas to perform data analysis in Python. You will start with an overview of data analysis and iteratively progress from modeling data, to accessing data from remote sources, performing numeric and statistical analysis, through indexing and performing aggregate analysis, and finally to visualizing statistical data and applying pandas to finance. With the knowledge you gain from this book, you will quickly learn pandas and how it can empower you in the exciting world of data manipulation, analysis and science.
Table of Contents (16 chapters)

Creating DataFrame objects

There are a number of ways to create a data frame. A data frame can be created from either a single or multi-dimensional set of data. The techniques that we will examine are as follows:

  • Using the results of NumPy functions
  • Using data from a Python dictionary consisting of lists or pandas Series objects
  • Using data from a CSV file

While examining each of these we will also examine how to specify column names, demonstrate how alignment is performed during initialization, and see how to determine the dimensions of a data frame.

Creating a DataFrame using NumPy function results

A data frame can be created from a one-dimensional NumPy array of integers ranging from 1 to 5:

The first column of the output...