The main pandas data structures – Series and DataFrame

Several classes for manipulating data are provided by pandas. Of those, we are interested in Series and more interested in DataFrame.

The Series

The Series is the primary building block of pandas and represents a one-dimensional labeled array based on the NumPy ndarray. The Series extends the functionality of the NumPy ndarray by adding an associated set of labels that are used to index the elements of the array. A Series can hold zero or more instances of any single data type.

This labeled index adds significant power to access the elements of the Series over a NumPy array. Instead of simply accessing elements by position, a Series allows access to items through the associated index labels. ...

Get Mastering pandas for Finance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.