shape: (4, 1)
Name |
---|
str |
"Joram" |
"Eleonora" |
"Lauren" |
"Enrico" |
hstack
Joram Mutenge
2025-10-11
If you have two tables with the same number of rows, you can combine them side by side to create a single table. Below are two dataframes to be combined.
name_df
Name |
---|
str |
"Joram" |
"Eleonora" |
"Lauren" |
"Enrico" |
profession_df
Profession |
---|
str |
"Data Consultant" |
"Software Engineer" |
"Nurse" |
"Film Producer" |
To combine the two dataframes into a single one, use the hstack
method like this:
Name | Profession |
---|---|
str | str |
"Joram" | "Data Consultant" |
"Eleonora" | "Software Engineer" |
"Lauren" | "Nurse" |
"Enrico" | "Film Producer" |
Learn more in my Polars course.