nodejs-polars
    Preparing search index...

    Function concat

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

      Parameters

      • items: pl.DataFrame<any>[]

        DataFrames/Series/LazyFrames to concatenate.

      • Optionaloptions: ConcatOptions

        Options for concat

        • Optionalhow?: "vertical" | "horizontal" | "diagonal"
        • Optionalrechunk?: boolean

      Returns pl.DataFrame

      > 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
      └─────┴──────┴──────┘
    • Aggregate all the Dataframes/Series in a List of DataFrames/Series to a single DataFrame/Series.

      Parameters

      • items: pl.Series<any, string>[]

        DataFrames/Series/LazyFrames to concatenate.

      • Optionaloptions: { rechunk: boolean }
        • rechunk: boolean

          rechunk the final DataFrame/Series.

      Returns pl.Series

      > 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
      └─────┴──────┴──────┘
    • Aggregate all the Dataframes/Series in a List of DataFrames/Series to a single DataFrame/Series.

      Parameters

      • items: LazyDataFrame[]

        DataFrames/Series/LazyFrames to concatenate.

      • Optionaloptions: ConcatOptions

        Options for concat

        • Optionalhow?: "vertical" | "horizontal" | "diagonal"
        • Optionalrechunk?: boolean

      Returns LazyDataFrame

      > 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
      └─────┴──────┴──────┘