NEW
Also known as: Pandas Series
One-dimensional, labeled array in pandas capable of holding any data type.
DESCRIPTION
A pandas Series models a one-dimensional array with an associated Index for axis labels. It supports vectorized operations, alignment by labels, missing value handling, and heterogeneous dtypes. Series underpin DataFrame columns and enable efficient arithmetic, aggregation, and broadcasting. Common use cases include feature vectors, time-indexed data, and intermediate pipeline results.
ALTERNATIVE DEFINITIONS
pandas Documentation
Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python objects, etc.).
Authoritative class reference with precise capabilities and dtype flexibility.
pandas User Guide
A Series is like a one-dimensional array, and it is labeled by an Index.
Introductory guide emphasizing labeled axis and analogy to arrays.
RELATED TERMS
DataFrame Index Temporal Data Vectorization Dtype Alignment loc iloc Missing Data
COMPETING TERMS
NumPy ndarray
RELATIONS
- Narrower: Time Series
KNOWLEDGE AREAS
Programming Languages Data Science Data Engineering Platform & Tooling
TARGET AUDIENCE
Data Scientist Data Engineer Analytics Engineer Data Analyst Software Developer
EXTERNAL SOURCES
- Wikipedia - Pandas (software)
- pandas - Official Series API reference.
- pandas - Series introduction in user guide.
- NumPy - NumPy ndarray for comparison.
TOP QUESTIONS
How does a pandas Series differ from a NumPy ndarray?
Series has axis labels (Index) and aligns operations by label, while ndarray is purely positional. Series can hold heterogeneous Python objects.
Category: Comparison
When should I use a Series versus a DataFrame?
Use Series for one-dimensional data or single columns; use DataFrame for multi-column tabular data and relational operations.
Category: Practice
How does alignment work in Series operations?
Arithmetic aligns on index labels, introducing NaN for missing labels. This simplifies combining partially overlapping data.
Category: Concept
How do I handle missing values in a Series?
Use isna, fillna, and dropna. New dtypes like nullable integer/string support NA semantics.
Category: Practice
What are common mistakes when using Series?
Mutating views unintentionally, ignoring index alignment, and mixing incompatible dtypes cause subtle bugs.
Category: Mistakes
Can a Series have a multi-level index?
Yes, a MultiIndex can label Series axes for hierarchical data, enabling advanced slicing and aggregation.
Category: Concept
How do I convert between Series and NumPy arrays?
Use .to_numpy() or .values for array extraction; wrap arrays with pd.Series to create labeled structures.
Category: Practice
How does vectorization help with Series performance?
Vectorized operations leverage optimized array computations, avoiding Python loops and improving speed significantly.
Category: Performance
How are time series represented with Series?
DatetimeIndex provides rich time-based indexing, resampling, and rolling operations directly on Series.
Category: Applications