Home → Pandas → Visualization
Reading
0%

1 · Core Concepts

Pandas integrates with Matplotlib for quick plotting: line, bar, histogram, scatter, box, pie charts directly from DataFrames and Series using .plot().

2 · Code Examples

Python
import pandas as pd
import numpy as np

# Example DataFrame
df = pd.DataFrame({
    "name": ["Alice","Bob","Charlie","Diana"],
    "age": [25,30,35,28],
    "salary": [50000,60000,70000,55000],
    "dept": ["Engineering","Marketing","Engineering","Marketing"]
})
print(df)
▶ Output
name age salary dept
0 Alice 25 50000 Engineering
1 Bob 30 60000 Marketing
2 Charlie 35 70000 Engineering
3 Diana 28 55000 Marketing

3 · Common Patterns

💡
Textbook Insight

Pandas is built on NumPy and provides high-performance, easy-to-use data structures. The two primary structures are Series (1D) and DataFrame (2D). Always prefer vectorized operations over loops.

4 · Best Practices

💡
Performance Tip

Use .apply() sparingly — prefer vectorized operations. Use category dtype for string columns with few unique values to save memory.