Skip to content

Commit

Permalink
docs: expand docstring for dtype function
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Aug 2, 2023
1 parent b9d65ef commit 39b7a24
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions ibis/expr/datatypes/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,26 @@


@lazy_singledispatch
def dtype(value, nullable=True) -> DataType:
"""Construct an ibis datatype from a python type."""
def dtype(value: Any, nullable: bool = True) -> DataType:
"""Create a DataType object.
Parameters
----------
value
The object to coerce to an Ibis DataType. Supported inputs include
strings, python type annotations, numpy dtypes, pandas dtypes, and
pyarrow types.
nullable
Whether the type should be nullable. Defaults to True.
Examples
--------
>>> import ibis
>>> ibis.dtype("int32")
Int32(nullable=True)
>>> ibis.dtype("array<float>")
Array(value_type=Float64(nullable=True), nullable=True)
"""
if isinstance(value, DataType):
return value
else:
Expand Down

0 comments on commit 39b7a24

Please sign in to comment.