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)

The .index and .values properties

Each Series object consists of a series of values and an index. The values can be accessed through the .values property:

The result from is a NumPy array object, as the following verifies:

This is called out for informational purposes. We will not examine NumPy arrays in this book. Historically, pandas did use NumPy arrays under the covers, so NumPy arrays were more important in the past, but this dependency has been removed in recent versions. But as a convenience, .values returns a NumPy array even if the underlying representation is not a NumPy array.

In addition, the index for the series can be retrieved using .index:

The type of index created by pandas is RangeIndex. This is a change in pandas from the previous version of this book, when this type of index did not exist. The RangeIndex object represents a range of values from the start...