Pandas is the dominant open-source Python library for data manipulation and analysis, built on top of NumPy and optionally accelerated by PyArrow. It provides two primary data structures, Series (1-dimensional) and DataFrame (2-dimensional), designed for efficient handling of structured data. Version 3.0 (January 2026, current 3.0.2) introduced Copy-on-Write as the default behavior, a dedicated str dtype for text data, and the new pd.col() expression syntax for cleaner column references, all of which improve performance, memory efficiency, and code readability. The library excels at reading from dozens of file formats, cleaning messy data, and transforming datasets for analysis, making it the go-to tool for data scientists working with tabular data in Python.
What This Cheat Sheet Covers
This topic spans 27 focused tables and 198 indexed concepts, 139 flashcards, 9 practice tests with 247 questions. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Core Data Structures
Everything in Pandas is built on two objects: the DataFrame, a labeled table, and the Series, a labeled column. The rows below cover how data is held and labeled, including the specialized index types and the Pandas 3.0 str dtype that finally treats text as a first-class type instead of a generic object.
| Structure | Example | Description | |
|---|---|---|---|
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}) | • 2-dimensional labeled data structure with columns of potentially different types • the primary Pandas object. | ||
s = pd.Series([1, 2, 3], index=['a', 'b', 'c']) | • 1-dimensional labeled array holding any data type • functions like a column in a DataFrame • arithmetic between two Series aligns on index labels, not position, so unmatched labels give NaN. | ||
idx = pd.Index(['x', 'y', 'z']) | • Immutable sequence implementing an ordered, sliceable set used for axis labels • idx[0] = 'a' raises TypeError. | ||
idx = pd.RangeIndex(start=0, stop=100, step=1) | • Default index type storing only start/stop/step instead of a full label array • in Pandas 3.0 many operations on it ( take, join, reindex, __getitem__) return a RangeIndex rather than materializing an Index. | ||
idx = pd.MultiIndex.from_tuples([('A', 1), ('A', 2)]) | • Hierarchical index with multiple named levels • folds extra dimensions into the index so grouping, selection, and reshaping can work one level at a time. | ||
cat = pd.Categorical(['a', 'b', 'a', 'c']) | • Data type for categorical variables drawn from a limited, fixed set of values • stores a categories array plus an integer codes array pointing into it, so each distinct value's text is held once. | ||
s = pd.Series(["hello", "world"]) # dtype: str | • New default in Pandas 3.0, strings are inferred as str instead of object• uses PyArrow under the hood for speed when installed, and falls back to object-backed storage when it is not (PyArrow is optional, not required). |