Series
What it is
A one-dimensional array of values with an index of labels attached to it, and a single dtype for the whole thing. A column pulled out of a DataFrame is a Series.
Why it matters
It is the unit almost every operation returns. Knowing that df["col"] gives you a Series — and df[["col"]] gives you a one-column DataFrame — explains half the 'why does this print differently' confusion.
In the real world: An online shop's daily revenue for the last 90 days is a Series: one number per date. Plotting the trend or finding the best day starts from it.
Visual example
Pandas SeriesA Series is values plus labels: one column of data with an index beside it.
Why this matters
Almost every operation hands you back a Series. Seeing it as labelled values explains most 'why does this print differently' moments.
Common misconception
Wrong idea: a Series is just a list of numbers.
Correct idea: it is values plus an index of labels, with one dtype for all of them.
- 1ValuesOne column of data, one dtype (
int64here). - 2LabelsEach value has an index label: a, b, c.
- 3Two ways inBy label with
s["b"], by position withs.iloc[1].
s = pd.Series([10, 20, 30], index=["a", "b", "c"], name="score")
s["b"] # 20, by label
s.iloc[1] # 20, by position
s.dtype # dtype('int64') — one dtype for the whole Series