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)

Retrieving values in a Series by label or position

Values in a Series can be retrieved in two general ways: by index label or by 0-based position. Pandas provides you with a number of ways to perform either of these lookups. Let's examine a few of the common techniques.

Lookup by label using the [] operator and the .ix[] property

An implicit label lookup is performed using the [] operator. This operator normally looks up values based upon the given index labels.

Let's start by using the following Series:

A single value can be looked up using just the index label of the desired item:

Multiple items can be retrieved at once using a list of index labels:

We can also look up values using integers that represent positions...