Skip to content

Commit

Permalink
Add docstring example to concat (#2137)
Browse files Browse the repository at this point in the history
As per the answer in #2135
  • Loading branch information
zundertj committed Dec 23, 2021
1 parent 47bde86 commit 3bca19d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions py-polars/polars/internals/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ def concat(
On of {"vertical", "diagonal"}.
Vertical: Applies multiple `vstack` operations.
Diagonal: Finds a union between the column schemas and fills missing column values with null.
Examples
--------
>>> df1 = pl.DataFrame({"a": [1], "b": [3]})
>>> df2 = pl.DataFrame({"a": [2], "b": [4]})
>>> pl.concat([df1, df2])
shape: (2, 2)
┌─────┬─────┐
│ a ┆ b │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1 ┆ 3 │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ 2 ┆ 4 │
└─────┴─────┘
"""
if not len(items) > 0:
raise ValueError("cannot concat empty list")
Expand Down

0 comments on commit 3bca19d

Please sign in to comment.