Practice Reshape Data: Concatenate
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Easy#2888
LeetCode ProblemReshape Data: Concatenate
Problem Statement
DataFrames df1 and df2 both have student_id (int), name (object) and age (int) columns. Concatenate them vertically, placing the rows of df2 after the rows of df1, and return the combined DataFrame.
Source: Reshape Data: Concatenate on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
df1 +------------+---------+-----+ | student_id | name | age | +------------+---------+-----+ | 1 | Mason | 8 | | 2 | Ava | 6 | | 3 | Taylor | 15 | | 4 | Georgia | 17 | +------------+---------+-----+ df2 +------------+------+-----+ | student_id | name | age | +------------+------+-----+ | 5 | Leo | 7 | | 6 | Alex | 7 | +------------+------+-----+
Output
+------------+---------+-----+ | student_id | name | age | +------------+---------+-----+ | 1 | Mason | 8 | | 2 | Ava | 6 | | 3 | Taylor | 15 | | 4 | Georgia | 17 | | 5 | Leo | 7 | | 6 | Alex | 7 | +------------+---------+-----+
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.