Convert the underlying int64 representation to the given unit. Compatibility function for pandas issue where "as_unit" is not defined for pandas.Timestamp in pandas versions < 2.2. Can be removed minimum pandas version is >= 2.2.
(date: pd.Timestamp, unit: PDDatetimeUnitOptions)
| 74 | |
| 75 | |
| 76 | def timestamp_as_unit(date: pd.Timestamp, unit: PDDatetimeUnitOptions) -> pd.Timestamp: |
| 77 | """Convert the underlying int64 representation to the given unit. |
| 78 | |
| 79 | Compatibility function for pandas issue where "as_unit" is not defined |
| 80 | for pandas.Timestamp in pandas versions < 2.2. Can be removed minimum |
| 81 | pandas version is >= 2.2. |
| 82 | """ |
| 83 | if hasattr(date, "as_unit"): |
| 84 | date = date.as_unit(unit) |
| 85 | elif hasattr(date, "_as_unit"): |
| 86 | date = date._as_unit(unit) |
| 87 | return date |
| 88 | |
| 89 | |
| 90 | def default_precision_timestamp(*args, **kwargs) -> pd.Timestamp: |
no outgoing calls
no test coverage detected
searching dependent graphs…