You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Pandas is the most important Python library for data manipulation and analysis. Built on top of NumPy, it provides two primary data structures — Series (1D) and DataFrame (2D) — that make working with structured data intuitive and efficient. The name comes from "Panel Data", a term from econometrics.
A Series is a one-dimensional labelled array:
import pandas as pd
import numpy as np
# Create from a list
s = pd.Series([10, 20, 30, 40, 50])
print(s)
# 0 10
# 1 20
# 2 30
# 3 40
# 4 50
# dtype: int64
# Create with custom index
s = pd.Series([10, 20, 30], index=['a', 'b', 'c'])
print(s['b']) # 20
# Create from a dictionary
s = pd.Series({'London': 9000000, 'Paris': 2200000, 'Berlin': 3600000})
print(s)
A DataFrame is a two-dimensional labelled table — the workhorse of Pandas:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.