Book Image

Learning Pandas

By : Michael Heydt
Book Image

Learning Pandas

By: Michael Heydt

Overview of this book

Table of Contents (19 chapters)
Learning pandas
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Series object


The Series is the primary building block of pandas. A Series represents a one-dimensional labeled indexed array based on the NumPy ndarray. Like an array, a Series can hold zero or more values of any single data type.

A pandas Series deviates from NumPy arrays by adding an associated set of labels that are used to index and efficiently access the elements of the array by the label values instead of just by the integer position. This labeled index is a key feature of pandas Series (and, as we will see, also a DataFrame) and adds significant power for accessing the elements of the Series over a NumPy array.

A Series always has an index even if one is not specified. In this default case, pandas will create an index that consists of sequential integers starting from zero. This default behavior will make a Series initially appear to be very similar to a NumPy array. This is by design, as a Series was derived from a NumPy array. This allowed a Series to be used by existing NumPy...