Код: Выделить всё
import polars as pl
data1 = {
'A': [1, 2, 3],
'B': [4, 5, 6],
'C': [7, 8, 9]
}
df1 = pl.DataFrame(data1)
data2 = {
'B': [4, 5, 6],
'C': [7, 8, 9],
'D': [1, 2, 3]
}
df2 = pl.DataFrame(data2)
# the column B and C are same in both data frames
# TODO: Join/Concat the data frames into one.
Результат должен выглядеть так:
Код: Выделить всё
result = {
'A': [1, 2, 3],
'B': [4, 5, 6],
'C': [7, 8, 9],
'D': [1, 2, 3]
}
pl.DataFrame(result)
Код: Выделить всё
shape: (3, 4)
┌─────┬─────┬─────┬─────┐
│ A ┆ B ┆ C ┆ D │
│ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 ┆ i64 │
╞═════╪═════╪═════╪═════╡
│ 1 ┆ 4 ┆ 7 ┆ 1 │
│ 2 ┆ 5 ┆ 8 ┆ 2 │
│ 3 ┆ 6 ┆ 9 ┆ 3 │
└─────┴─────┴─────┴─────┘
Подробнее здесь: https://stackoverflow.com/questions/773 ... lumn-names