Skip to content

Commit e0e5ba4

Browse files
authored
docs: Add API example docs for Field dtype (#2131)
1 parent 9173b79 commit e0e5ba4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

narwhals/dtypes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ class Field:
453453
Arguments:
454454
name: The name of the field within its parent `Struct`.
455455
dtype: The `DataType` of the field's values.
456+
457+
Examples:
458+
>>> import pyarrow as pa
459+
>>> import narwhals as nw
460+
>>> data = [{"a": 1, "b": ["narwhal", "beluga"]}, {"a": 2, "b": ["orca"]}]
461+
>>> ser_pa = pa.chunked_array([data])
462+
>>> nw.from_native(ser_pa, series_only=True).dtype.fields
463+
[Field('a', Int64), Field('b', List(String))]
456464
"""
457465

458466
name: str

0 commit comments

Comments
 (0)