Function concat

  • Aggregate all the Dataframes/Series in a List of DataFrames/Series to a single DataFrame/Series.

    Parameters

    Returns pl.DataFrame

    Example

    > const df1 = pl.DataFrame({"a": [1], "b": [3]});
    > const df2 = pl.DataFrame({"a": [2], "b": [4]});
    > pl.concat([df1, df2]);
    shape: (2, 2)
    ┌─────┬─────┐
    ab
    │ --- ┆ --- │
    i64i64
    ╞═════╪═════╡
    13
    ├╌╌╌╌╌┼╌╌╌╌╌┤
    24
    └─────┴─────┘

    > const a = pl.DataFrame({ a: ["a", "b"], b: [1, 2] });
    > const b = pl.DataFrame({ c: [5, 6], d: [7, 8], e: [9, 10]});
    > pl.concat([a, b], { how: "horizontal" });

    shape: (2, 5)
    ┌─────┬─────┬─────┬─────┬──────┐
    abcde
    │ --- ┆ --- ┆ --- ┆ --- ┆ --- │
    strf64f64f64f64
    ╞═════╪═════╪═════╪═════╪══════╡
    a1.05.07.09.0
    b2.06.08.010.0
    └─────┴─────┴─────┴─────┴──────┘

    > const df_d1 = pl.DataFrame({"a": [1], "b": [3]});
    > const df_d2 = pl.DataFrame({"a": [2], "c": [4]});
    > pl.concat([df_d1, df_d2], { how: "diagonal" });

    shape: (2, 3)
    ┌─────┬──────┬──────┐
    abc
    │ --- ┆ --- ┆ --- │
    i64i64i64
    ╞═════╪══════╪══════╡
    13null
    2null4
    └─────┴──────┴──────┘
  • Type Parameters

    • T

    Parameters

    • items: pl.Series[]
    • Optional options: {
          rechunk: boolean;
      }
      • rechunk: boolean

    Returns pl.Series