pandas.DatetimeIndex.as_unit
pandas 3.1.1 · Index objects · method
Change the storage unit of time values, subject to precision and rounding rules.
Call syntax
DatetimeIndex.as_unit(unit)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. |
Returns
same type as self