Skip to content
Learn Netverks

Lesson

Step 6/36 17% through track

series-dataframe-intro

Series and DataFrame intro

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~2 min
Level
beginner

This lesson

An orientation to the Pandas track—Series, DataFrames, wrangling, groupby, merges, and links to SciPy/sklearn next.

You need labeled-table fluency before sklearn and production ETL—otherwise groupby, merge, and datetime bugs dominate every sprint.

You will apply Series and DataFrame intro in contexts like: CSV/Parquet analysis, ETL notebooks, and ad hoc reporting.

Read the narrative, run `import pandas as pd` snippets with in-memory DataFrames (install pandas and numpy with pip if needed), inspect `.head()`, `.dtypes`, and complete MCQs. Also read the interview prep blocks; print `df.shape`, `df.dtypes`, and `df.head()` after every transform.

After /python/intro and /numpy/intro—when you are ready for labeled tables and daily wrangling workflows.

A Series is a one-dimensional labeled array; a DataFrame is a collection of Series sharing a row index. Both preserve labels through operations—unlike raw NumPy arrays.

Creating a Series

import pandas as pd
import numpy as np

s = pd.Series([10, 20, 30], index=['a', 'b', 'c'], name='score')
print(s)
print(s.index, s.dtype)

Creating a DataFrame

  • From dict of lists: pd.DataFrame({'col': [1,2,3]})
  • From dict of Series: columns align on index automatically
  • From 2D NumPy array: pass columns= and index=
  • From list of dicts (JSON-like records): pd.DataFrame(records)

Key attributes

  • .index — row labels
  • .columns — column names (DataFrame only)
  • .values / .to_numpy() — underlying array
  • .shape, .dtypes, .ndim

Important interview questions and answers

  1. Q: Dict of lists vs list of dicts?
    A: Dict of lists = column-oriented; list of dicts = row-oriented (API JSON). Both produce DataFrames.
  2. Q: Shared index?
    A: When building from Series, Pandas aligns rows by index label—missing labels become NaN.

Self-check

  1. Create a Series with a custom index.
  2. How do you list all column names?

Tip: Print type(df['col']) vs type(df[['col']]) once—it prevents selection bugs.

Interview prep

Shared index?

Building from dict of Series aligns rows by index label.

columns attribute?

Index object listing column names on DataFrame.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Index role?
  • Column dtypes?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump