Skip to content

Commit

Permalink
Update strptime() docstrings and type hints to include Time (#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgreg committed May 26, 2022
1 parent 1fb0ae3 commit afb4df7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions py-polars/polars/internals/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3656,18 +3656,18 @@ def __init__(self, expr: Expr):

def strptime(
self,
datatype: Union[Type[Date], Type[Datetime]],
datatype: Union[Type[Date], Type[Datetime], Type[Time]],
fmt: Optional[str] = None,
strict: bool = True,
exact: bool = True,
) -> Expr:
"""
Parse utf8 expression as a Date/Datetimetype.
Parse a UTF8 expression to a Date/Datetime/Time type.
Parameters
----------
datatype
Date | Datetime.
Date | Datetime | Time.
fmt
format to use, see the following link for examples:
https://docs.rs/chrono/latest/chrono/format/strftime/index.html
Expand Down Expand Up @@ -3732,7 +3732,7 @@ def strptime(
return wrap_expr(self._pyexpr.str_parse_time(fmt, strict, exact))
else:
raise ValueError(
"dtype should be of type {Date, Datetime}"
"dtype should be of type {Date, Datetime, Time}"
) # pragma: no cover

def lengths(self) -> Expr:
Expand Down
6 changes: 3 additions & 3 deletions py-polars/polars/internals/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3754,7 +3754,7 @@ def __init__(self, series: "Series"):

def strptime(
self,
datatype: Union[Type[Date], Type[Datetime]],
datatype: Union[Type[Date], Type[Datetime], Type[Time]],
fmt: Optional[str] = None,
strict: bool = True,
exact: bool = True,
Expand All @@ -3765,7 +3765,7 @@ def strptime(
Parameters
----------
datatype
Date or Datetime.
Date, Datetime or Time.
fmt
format to use, see the following link for examples:
https://docs.rs/chrono/latest/chrono/format/strftime/index.html
Expand All @@ -3779,7 +3779,7 @@ def strptime(
Returns
-------
A Date/ Datetime Series
A Date / Datetime / Time Series
Examples
--------
Expand Down

0 comments on commit afb4df7

Please sign in to comment.