{"record":{"id":"b8c5d489c8ecb48a","repo":"pandas-dev/pandas","slug":"nonexistent-is-not-supported","errorCode":null,"errorMessage":"nonexistent is not supported.","messagePattern":"nonexistent is not supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/arrow/array.py","lineNumber":4174,"sourceCode":"    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\",\n            \"us\": \"microsecond\",\n            \"ns\": \"nanosecond\",","sourceCodeStart":4156,"sourceCodeEnd":4192,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/arrays/arrow/array.py#L4156-L4192","documentation":"Raised by ArrowExtensionArray._round_temporally when `nonexistent != \"raise\"`. The pyarrow-backed dt.ceil/floor/round cannot resolve nonexistent (skipped) times that appear during DST spring-forward; only the default 'raise' is supported. Passing 'shift_forward', 'shift_backward', 'NaT', or a timedelta triggers NotImplementedError.","triggerScenarios":"Calling `s.dt.ceil(\"h\", nonexistent=\"shift_forward\")` on a tz-aware pyarrow timestamp Series whose values fall in a DST gap (e.g. 02:00-03:00 on US spring-forward). Reached through dt.ceil/floor/round on timestamp[pyarrow, tz=...].","commonSituations":"Localizing/rounding logs or sensor data timestamped in a tz with DST; porting rounding code from numpy-backed datetime64 that accepted nonexistent kwargs.","solutions":["Leave nonexistent at default 'raise' and filter/adjust the offending timestamps beforehand.","Round in UTC then convert back: `s.dt.tz_convert(\"UTC\").dt.floor(\"h\").dt.tz_convert(\"US/Eastern\")`.","Cast to datetime64[ns, tz] for the operation: `s.astype(\"datetime64[ns, US/Eastern]\").dt.floor(\"h\", nonexistent=\"shift_forward\")`.","Drop DST timezone for rounding if precision loss is acceptable."],"exampleFix":"# before\ns.dt.floor(\"h\", nonexistent=\"shift_forward\")  # NotImplementedError\n\n# after\nout = s.dt.tz_convert(\"UTC\").dt.floor(\"h\").dt.tz_convert(\"US/Eastern\")","handlingStrategy":"validation","validationCode":"def safe_round(s, freq, method=\"floor\", ambiguous=\"raise\"):\n    if getattr(s.dt, \"tz\", None) is not None:\n        return s.dt.tz_convert(\"UTC\").dt.__getattribute__(method)(freq, ambiguous=ambiguous).dt.tz_convert(s.dt.tz)\n    return s.dt.__getattribute__(method)(freq, ambiguous=ambiguous)","typeGuard":"def needs_utc_rounding(s) -> bool:\n    return getattr(s.dt, \"tz\", None) is not None","tryCatchPattern":"try:\n    out = s.dt.ceil(freq, nonexistent=nonexistent)\nexcept NotImplementedError:\n    out = s.dt.tz_convert(\"UTC\").dt.ceil(freq).dt.tz_convert(s.dt.tz)","preventionTips":["Keep nonexistent='raise' (default) for pyarrow timestamp rounding.","Round tz-aware pyarrow timestamps in UTC, then convert back.","Filter out DST-gap times before rounding with nonexistent='raise'."],"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"}