pandas.Series.dt.as_unit
pandas 3.1.1 · Series and accessors · method
Change the storage unit of time values, subject to precision and rounding rules.
Call syntax
Series.dt.as_unit(unit, round_ok=True)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
unit |
Required Positional or keyword |
{'s', 'ms', 'us', 'ns'} Specify the time unit represented by each number or required by the result. |
round_ok |
Optional Positional or keyword Default True |
bool |
Returns
same type as self