Skip to content

Commit

Permalink
docs: improve new_series docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
raisadz committed Nov 13, 2024
1 parent babe141 commit a71b6cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions narwhals/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def new_series(
native_namespace: ModuleType,
) -> Series:
"""
Instantiate Narwhals Series from raw data.
Instantiate Narwhals Series from iterable (e.g. list or array).
Arguments:
name: Name of resulting Series.
Expand All @@ -188,7 +188,12 @@ def new_series(
... def func(df):
... values = [4, 1, 2]
... native_namespace = nw.get_native_namespace(df)
... return nw.new_series("c", values, nw.Int32, native_namespace=native_namespace)
... return nw.new_series(
... name="c",
... values=values,
... dtype=nw.Int32,
... native_namespace=native_namespace,
... )
Let's see what happens when passing pandas / Polars input:
Expand Down

0 comments on commit a71b6cc

Please sign in to comment.