🐼 Pandas
Series & DataFrame
In-depth analysis of the Series and DataFrame structures, their relationship with NumPy, and the power of the Index object.
● Beginner
📖 Based on: Python for Data Analysis — Wes McKinney
📋 Core Objects: The Internal Architecture
1 · The Philosophy of Labeled Data
At its heart, Pandas is about Metadata. Unlike NumPy, which focuses on raw numeric arrays, Pandas attaches meaning to data through labels. This allows for automatic data alignment—a feature Wes McKinney describes as the 'killer feature' of the library.
2 · Series: 1D Homogeneous Data
A Series is a one-dimensional array-like object containing a sequence of values and an associated array of data labels.
Python
import pandas as pd s = pd.Series([7, 'Python', 3.14, -5], index=['a', 'b', 'c', 'd']) print(s.values) # returns ndarray print(s.index) # returns Index object
4 · The Index Object
The Index object is the backbone of Pandas. It is Immutable. Once created, you cannot change a label directly. This ensures that data alignment remains consistent across operations.