Guided Notes

Series & DataFrames

Creating Series with labels, building DataFrames, the index, and selecting rows with loc and iloc.

Creating a Series

Slide 1 / 5

A Series is like a column: a one-dimensional array of values, each with a label.

s = pd.Series([1, 7, 2])

Without labels, pandas numbers them 0, 1, 2… Choose your own with index:

s = pd.Series([1, 7, 2], index=['x', 'y', 'z']) s['y'] β†’ 7

Labels make data self-describing: sales['March'] is clearer than sales[2].

← Introduction to Pandas