A Series is essentially a NumPy array with an attached index: every value has a corresponding label, 0, 1, 2... by default, or custom labels you provide, which lets you look up values by name instead of only by position. Internally it stores its values in a single, contiguous NumPy array sharing one dtype, giving it the same vectorized-operation performance as NumPy, while the index adds the labeled, dictionary-like access that makes pandas convenient for real-world tabular data. A single column of a DataFrame is itself a Series.
1Understanding pd.Series()
A Series is essentially a NumPy array with an attached index: every value has a corresponding label, 0, 1, 2... by default, or custom labels you provide, which lets you look up values by name instead of only by position. Internally it stores its values in a single, contiguous NumPy array sharing one dtype, giving it the same vectorized-operation performance as NumPy, while the index adds the labeled, dictionary-like access that makes pandas convenient for real-world tabular data. A single column of a DataFrame is itself a Series.
Passing a dict to pd.Series() automatically uses the dict's keys as the index and its values as the data, in insertion order — a common, convenient shortcut for building a labeled Series directly from key-value data.
import pandas as pd
s = pd.Series([10, 20, 30], index=["a", "b", "c"])
print(s)2Practical Example
Here is a real-world application of pd.Series() showing how it is used in production Pandas code.
import pandas as pd
population = pd.Series({"NY": 8.4, "LA": 4.0, "CHI": 2.7})
print(population["LA"])3Best Practices
Follow these guidelines when working with pd.Series():
1. Give a Series a meaningful custom index, instead of the default integer range, whenever the labels themselves carry meaning, like dates or IDs
2. Use vectorized Series operations instead of looping over elements manually, for both speed and readability
3. Set the dtype explicitly when the default type inference doesn't match your intent, the same consideration as with a plain NumPy array
Tip: Passing a dict to pd.Series() automatically uses the dict's keys as the index and its values as the data, in insertion order — a common, convenient shortcut for building a labeled Series directly from key-value data.
import pandas as pd
s = pd.Series([10, 20, 30], index=["a", "b", "c"])
print(s)