Skip to content
Learn Netverks

Lesson

Step 22/36 61% through track

concat-append

Concat and append

Last reviewed Jun 1, 2026 Content v20260601
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Concat and append: Pandas tabular manipulation—indexing, dtypes, reshaping, and analysis habits for real-world tables.

Teams apply Concat and append in every serious Pandas project—skipping it leaves blind spots in analysis and reviews.

You will apply Concat and append 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.

When you can explain the previous lesson's ideas in your own words.

pd.concat stacks DataFrames vertically (more rows) or horizontally (more columns). Use when combining batches, time periods, or aligned feature columns.

Vertical concat

import pandas as pd
a = pd.DataFrame({'x': [1, 2]})
b = pd.DataFrame({'x': [3, 4]})
combined = pd.concat([a, b], ignore_index=True)
print(combined)

Horizontal concat

left = pd.DataFrame({'id': [1, 2], 'a': [10, 20]})
right = pd.DataFrame({'b': [100, 200]})
wide = pd.concat([left, right], axis=1)
print(wide)

Options

  • ignore_index=True — reset row index after vertical stack
  • keys= — add hierarchical index showing source
  • join='inner'|'outer' — column alignment for axis=1

Important interview questions and answers

  1. Q: concat vs merge?
    A: concat stacks same-schema tables; merge joins on keys horizontally by rows.
  2. Q: append deprecated?
    A: DataFrame.append removed—use pd.concat([df1, df2]).

Self-check

  1. Stack two DataFrames vertically with fresh index.
  2. When use axis=1 concat?

Tip: Collect DataFrames in a list, then one pd.concat—not repeated concat in a loop.

Interview prep

concat vs merge?

concat stacks same-schema tables; merge joins on keys.

append removed?

Use pd.concat([df1, df2]) instead of DataFrame.append.

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

  • concat axis?
  • ignore_index?

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