Pandas Series

A series is a one-dimensional, labeled array — the building block a data frame is made of, where every single column in a pandas DataFrame is, individually, a Series object. Where a data frame holds multiple columns of potentially different types arranged in a table, a series holds exactly one sequence of values, each paired with a label (an index), which is what lets a series support the same label-based lookup a data frame's rows and columns support (series['2024-01-15'] or series.loc['customer_42']) rather than only positional access.

The index is what separates a series from a plain list or array, and it's also the mechanism that makes operations between two series behave predictably even when they aren't perfectly aligned. Adding two series together doesn't simply add values in positional order the way adding two plain lists would; pandas aligns the two series by their index labels first, matching up values that share the same label and inserting a missing value (NaN) wherever a label exists in one series but not the other — a behavior that's deliberately different from, and more forgiving than, raw array addition, because it means two series pulled from different but related sources (say, one indexed by customer ID and containing order counts, another indexed by customer ID and containing total spend) can be combined correctly even if they don't contain exactly the same customers in exactly the same order.

DataFrame
a table — multiple columns, potentially different types
Each column is individually a Series
one-dimensional, labeled, single data type
Index-based alignment, not positional
series_a + series_b
matched by shared labels, not by position
Unmatched labels
filled with NaN rather than causing an error
Two series from different sources combine correctly
even when not in the same order or covering the same records

A time series is the most common and consequential specialized application of the series structure: a series indexed by timestamps or dates rather than arbitrary labels, which unlocks time-specific operations — resampling (converting daily data into weekly or monthly summaries), rolling windows (computing a moving average over a trailing window of time), and shifting (comparing a value to its value some fixed number of periods earlier, used to compute period-over-period growth). These operations depend specifically on the index being ordered and time-aware; the same operations on a series indexed by, say, arbitrary customer IDs wouldn't have a coherent meaning, since there's no inherent "before" or "after" relationship between customer IDs the way there is between dates.

A series' single data type constraint — every element in a given series must share one dtype (integer, float, string, datetime, and so on) — has a practical consequence that trips up newcomers: inserting even a single missing or mixed-type value into an otherwise uniform numeric series can force the entire series to be upcast to a less specific type (a column of whole-number integers silently becoming floats the moment a single null enters it, since integer types traditionally have no native representation for "missing" while floating-point types do), a behavior inherited directly from how NumPy, the array library underlying pandas, handles type and missing-value representation.

Read a series as the labeled, one-dimensional unit a data frame is assembled from: its index is what enables both meaningful label-based lookup and safe, alignment-aware arithmetic between series that don't perfectly match row for row, the time series is its most consequential specialization — unlocking resampling, rolling windows, and period comparisons that only make sense when the index represents a genuine ordering in time — and its single-type constraint is the direct source of the type-upcasting quirks that are among the more commonly confusing behaviors newcomers encounter in practice.

Take pandas series further

Ask the copilot about this term, or have our engineers assess it against your process.