Pandasdrill

Level 4: Combining and reshaping Exercise 31 of 45 Pro

Stack two tables with concat

A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.

The task

Stack `jan` on top of `feb` into one table with a fresh 0, 1, 2, ... index.

What this exercise teaches

concat glues the frames in list order. Without ignore_index the original labels are kept, so the index would repeat 0, 1, 2 for each month.

A hint if you get stuck

pd.concat takes a list of DataFrames. ignore_index=True renumbers the rows.

This exercise is part of Pro

Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.

You create a free account first, so Pro is attached to it.

Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.

Start with the free exercises

More exercises in Combining and reshaping