{"record":{"id":"550852324616a22a","repo":"pandas-dev/pandas","slug":"ambiguous-is-not-supported","errorCode":null,"errorMessage":"ambiguous is not supported.","messagePattern":"ambiguous is not supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/arrow/array.py","lineNumber":4172,"sourceCode":"        return self.dtype.pyarrow_dtype.unit\n\n    def _dt_normalize(self) -> Self:\n        result = pc.floor_temporal(self._pa_array, 1, \"day\")\n        return self._from_pyarrow_array(result)\n\n    def _dt_strftime(self, format: str) -> Self:\n        result = pc.strftime(self._pa_array, format=format)\n        return self._from_pyarrow_array(result)\n\n    def _round_temporally(\n        self,\n        method: Literal[\"ceil\", \"floor\", \"round\"],\n        freq,\n        ambiguous: TimeAmbiguous = \"raise\",\n        nonexistent: TimeNonexistent = \"raise\",\n    ) -> Self:\n        if ambiguous != \"raise\":\n            raise NotImplementedError(\"ambiguous is not supported.\")\n        if nonexistent != \"raise\":\n            raise NotImplementedError(\"nonexistent is not supported.\")\n        offset = to_offset(freq)\n        if offset is None:\n            raise ValueError(f\"Must specify a valid frequency: {freq}\")\n        pa_supported_unit = {\n            \"Y\": \"year\",\n            \"YS\": \"year\",\n            \"Q\": \"quarter\",\n            \"QS\": \"quarter\",\n            \"M\": \"month\",\n            \"MS\": \"month\",\n            \"W\": \"week\",\n            \"D\": \"day\",\n            \"h\": \"hour\",\n            \"min\": \"minute\",\n            \"s\": \"second\",\n            \"ms\": \"millisecond\",","sourceCodeStart":4154,"sourceCodeEnd":4190,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/arrays/arrow/array.py#L4154-L4190","documentation":"Raised by ArrowExtensionArray._round_temporally when `ambiguous != \"raise\"`. The pyarrow-backed implementation of dt.ceil / dt.floor / dt.round only supports the default DST-handling behavior (raise on ambiguous times); it cannot resolve fold/ambiguous timestamps for rounding. Any other value for `ambiguous` (e.g. 'infer', True/False arrays, 'NaT') triggers NotImplementedError.","triggerScenarios":"Calling `s.dt.floor(\"h\", ambiguous=\"infer\")` or `s.dt.round(\"h\", ambiguous=array_of_bools)` on a tz-aware pyarrow timestamp Series during DST transitions. Reached through dt.ceil/floor/round on timestamp[pyarrow, tz=...].","commonSituations":"Timezone-aware datasets that cross DST boundaries (e.g. US/Eastern fall-back). Reusing rounding code from tz-naive or numpy-backed timestamps that silently accepted ambiguous kwargs.","solutions":["Leave ambiguous at its default 'raise' and handle the DST transition explicitly before rounding.","Pre-localize to a timezone without DST (e.g. UTC) and round there, then convert back: `s.dt.tz_convert(\"UTC\").dt.floor(\"h\").dt.tz_convert(\"US/Eastern\")`.","Cast to datetime64[ns] for the rounding step: `s.astype(\"datetime64[ns, US/Eastern]\").dt.floor(\"h\", ambiguous=...)` then back to pyarrow.","Drop the tz for rounding if the application tolerates it."],"exampleFix":"# before\ns = pd.Series(..., dtype=\"timestamp[us, tz=US/Eastern][pyarrow]\")\ns.dt.floor(\"h\", ambiguous=\"infer\")  # NotImplementedError\n\n# after: round in UTC\nout = s.dt.tz_convert(\"UTC\").dt.floor(\"h\").dt.tz_convert(\"US/Eastern\")","handlingStrategy":"validation","validationCode":"def safe_round(s, freq, method=\"floor\", nonexistent=\"raise\"):\n    if getattr(s.dt, \"tz\", None) is not None:  # tz-aware\n        # round in UTC to avoid ambiguous handling\n        return s.dt.tz_convert(\"UTC\").dt.__getattribute__(method)(freq, nonexistent=nonexistent).dt.tz_convert(s.dt.tz)\n    return s.dt.__getattribute__(method)(freq, nonexistent=nonexistent)","typeGuard":"def needs_utc_rounding(s) -> bool:\n    return getattr(s.dt, \"tz\", None) is not None","tryCatchPattern":"try:\n    out = s.dt.floor(freq, ambiguous=ambiguous)\nexcept NotImplementedError:\n    out = s.dt.tz_convert(\"UTC\").dt.floor(freq).dt.tz_convert(s.dt.tz)","preventionTips":["Default ambiguous to 'raise' for pyarrow timestamp rounding.","Round in UTC for tz-aware pyarrow timestamps, then convert back.","Document DST limitations in shared rounding helpers."],"tags":["pyarrow","datetime-accessor","dst","not-implemented"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}