class_docstr: Namespace for datetime related expressions.
docstr: Cast the underlying data to another time unit. This may lose precision.
  
  Parameters
  ----------
  time_unit : {'ns', 'us', 'ms'}
      Time unit for the `Datetime` expression.
  
  Examples
  --------
  >>> from datetime import datetime
  >>> df = pl.DataFrame(
  ...     {
  ...         "date": pl.datetime_range(
  ...             datetime(2001, 1, 1), datetime(2001, 1, 3), "1d", eager=True
  ...         )
  ...     }
  ... )
  >>> df.select(
  ...     [
  ...         pl.col("date"),
  ...         pl.col("date").dt.cast_time_unit("ms").alias("time_unit_ms"),
  ...         pl.col("date").dt.cast_time_unit("ns").alias("time_unit_ns"),
  ...     ]
  ... )
  shape: (3, 3)
  ┌─────────────────────┬─────────────────────┬─────────────────────┐
  │ date                ┆ time_unit_ms        ┆ time_unit_ns        │
  │ ---                 ┆ ---                 ┆ ---                 │
  │ datetime[μs]        ┆ datetime[ms]        ┆ datetime[ns]        │
  ╞═════════════════════╪═════════════════════╪═════════════════════╡
  │ 2001-01-01 00:00:00 ┆ 2001-01-01 00:00:00 ┆ 2001-01-01 00:00:00 │
  │ 2001-01-02 00:00:00 ┆ 2001-01-02 00:00:00 ┆ 2001-01-02 00:00:00 │
  │ 2001-01-03 00:00:00 ┆ 2001-01-03 00:00:00 ┆ 2001-01-03 00:00:00 │
  └─────────────────────┴─────────────────────┴─────────────────────┘
docstr_tok: ["Cast","the","underlying","data","to","another","time","unit",".","This","may","lose","precision",".","Parameters","--","--","--","--","--","time_unit",":","{","'ns","'",",","'us","'",",","'ms","'","}","Time","unit","for","the","`","Datetime","`","expression",".","Examples","--","--","--","--",">",">",">","from","datetime","import","datetime",">",">",">","df","=","pl.DataFrame","(","...","{","...","``","date","''",":","pl.datetime_range","(","...","datetime","(","2001",",","1",",","1",")",",","datetime","(","2001",",","1",",","3",")",",","``","1d","''",",","eager=True","...",")","...","}","...",")",">",">",">","df.select","(","...","[","...","pl.col","(","``","date","''",")",",","...","pl.col","(","``","date","''",")",".dt.cast_time_unit","(","``","ms","''",")",".alias","(","``","time_unit_ms","''",")",",","...","pl.col","(","``","date","''",")",".dt.cast_time_unit","(","``","ns","''",")",".alias","(","``","time_unit_ns","''",")",",","...","]","...",")","shape",":","(","3",",","3",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","date","\u2506","time_unit_ms","\u2506","time_unit_ns","\u2502","\u2502","--","-","\u2506","--","-","\u2506","--","-","\u2502","\u2502","datetime","[","\u03bcs","]","\u2506","datetime","[","ms","]","\u2506","datetime","[","ns","]","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","2001-01-01","00:00:00","\u2506","2001-01-01","00:00:00","\u2506","2001-01-01","00:00:00","\u2502","\u2502","2001-01-02","00:00:00","\u2506","2001-01-02","00:00:00","\u2506","2001-01-02","00:00:00","\u2502","\u2502","2001-01-03","00:00:00","\u2506","2001-01-03","00:00:00","\u2506","2001-01-03","00:00:00","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def cast_time_unit(self, time_unit: TimeUnit) -> Expr:
      """
      Cast the underlying data to another time unit. This may lose precision.
  
      Parameters
      ----------
      time_unit : {'ns', 'us', 'ms'}
          Time unit for the `Datetime` expression.
  
      Examples
      --------
      >>> from datetime import datetime
      >>> df = pl.DataFrame(
      ...     {
      ...         "date": pl.datetime_range(
      ...             datetime(2001, 1, 1), datetime(2001, 1, 3), "1d", eager=True
      ...         )
      ...     }
      ... )
      >>> df.select(
      ...     [
      ...         pl.col("date"),
      ...         pl.col("date").dt.cast_time_unit("ms").alias("time_unit_ms"),
      ...         pl.col("date").dt.cast_time_unit("ns").alias("time_unit_ns"),
      ...     ]
      ... )
      shape: (3, 3)
      ┌─────────────────────┬─────────────────────┬─────────────────────┐
      │ date                ┆ time_unit_ms        ┆ time_unit_ns        │
      │ ---                 ┆ ---                 ┆ ---                 │
      │ datetime[μs]        ┆ datetime[ms]        ┆ datetime[ns]        │
      ╞═════════════════════╪═════════════════════╪═════════════════════╡
      │ 2001-01-01 00:00:00 ┆ 2001-01-01 00:00:00 ┆ 2001-01-01 00:00:00 │
      │ 2001-01-02 00:00:00 ┆ 2001-01-02 00:00:00 ┆ 2001-01-02 00:00:00 │
      │ 2001-01-03 00:00:00 ┆ 2001-01-03 00:00:00 ┆ 2001-01-03 00:00:00 │
      └─────────────────────┴─────────────────────┴─────────────────────┘
  
      """
      return wrap_expr(self._pyexpr.dt_cast_time_unit(time_unit))
  
imports: from __future__ import annotations
  import datetime
  from typing import TYPE_CHECKING
  import polars._reexport
  from polars import functions
  from polars.datatypes import DTYPE_TEMPORAL_UNITS, Date, Int32
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
  from polars.utils.convert import _timedelta_to_pl_duration
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_saturating, issue_deprecation_warning, rename_use_earliest_to_ambiguous
label_desc: Use image node_id 28 for calling the ExprDateTimeNameSpace obj's underlying member method code with example usage: obj.cast_time_unit(time_unit) and returns: wrap_expr