RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Python for AI — Zero to Useful
  6. /Ch. 13
Python for AI — Zero to Useful

13. Pandas Series

Chapter 13 of 36 · 20 min
KEY INSIGHT

Series extend NumPy arrays with labels (index) and missing data support. Use `.iloc[]` for position-based access, `.loc[]` for label-based access.

What Is Pandas

Pandas provides DataFrame and Series objects for structured data. Series is a single column; DataFrame is a table. If NumPy is for numerical arrays, Pandas is for labeled tabular data.

Creating Series

import pandas as pd

# From a list
temperatures = pd.Series([0.0, 0.3, 0.5, 0.7, 0.9, 1.0])

# With custom index
models = pd.Series(
    ["gpt-4", "gpt-3.5-turbo", "claude-3"],
    index=["openai_1", "openai_2", "anthropic"]
)

# From a dictionary
costs = pd.Series({
    "gpt-4": 0.03,
    "gpt-3.5-turbo": 0.002,
    "claude-3": 0.015
})

Series Operations

costs = pd.Series({"gpt-4": 0.03, "gpt-3.5-turbo": 0.002, "claude-3": 0.015})

print(costs * 1000)      # Convert to per-1K cost
print(costs > 0.01)      # Boolean mask
print(costs[costs > 0.01])  # Filter expensive models

Indexing

models = pd.Series(["gpt-4", "claude-3", "llama-2"], index=["a", "b", "c"])

print(models["a"])           # gpt-4
print(models.iloc[0])        # gpt-4 (positional)
print(models.loc["a"])        # gpt-4 (label-based)

Handling Missing Data

data = pd.Series([1, 2, None, 4, 5])
print(data.isna())          # [False, False, True, False, False]
print(data.fillna(0))       # Replace None with 0
print(data.dropna())        # Remove None entries
print(data.mean())          # Ignores None: 3.0

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Create a Series of model response times in milliseconds. Calculate the average, find the fastest model, and replace any missing values with the median.

← Chapter 12
NumPy Broadcasting
Chapter 14 →
Pandas DataFrames