original_docstring: Parse dates according to typical DWD spec: CET up to 2000, UTC thereafter.
docstring: Parse dates according to typical DWD spec: CET up to 2000, UTC thereafter.
docstring_tokens: Parse dates according to typical DWD spec : CET up to 2000 UTC thereafter .
code: def y2k_date_parser(col, date_format="%Y%m%d%H%M"):
      """Parse dates according to typical DWD spec: CET up to 2000, UTC thereafter."""
  
      y2k = pd.Timestamp("2000-01-01")
  
      col_raw = pd.to_datetime(col, format=date_format)
      col_raw = col_raw.to_series(keep_tz=True).reset_index(drop=True)
  
      pre_y2k_bool = col_raw < y2k
  
      col_raw[pre_y2k_bool] = (
          col_raw[pre_y2k_bool]
          .dt.tz_localize(tz="CET", ambiguous="NaT", nonexistent="NaT")
          .dt.tz_convert("UTC")
      )
      col_raw[~pre_y2k_bool] = col_raw[~pre_y2k_bool].dt.tz_localize(tz="UTC")
  
      return pd.to_datetime(col_raw, utc=True)
code_tokens: def y2k_date_parser ( col , date_format = "%Y%m%d%H%M" ) : y2k = pd . Timestamp ( "2000-01-01" ) col_raw = pd . to_datetime ( col , format = date_format ) col_raw = col_raw . to_series ( keep_tz = True ) . reset_index ( drop = True ) pre_y2k_bool = col_raw < y2k col_raw [ pre_y2k_bool ] = ( col_raw [ pre_y2k_bool ] . dt . tz_localize ( tz = "CET" , ambiguous = "NaT" , nonexistent = "NaT" ) . dt . tz_convert ( "UTC" ) ) col_raw [ ~ pre_y2k_bool ] = col_raw [ ~ pre_y2k_bool ] . dt . tz_localize ( tz = "UTC" ) return pd . to_datetime ( col_raw , utc = True )
short_docstring: Parse dates according to typical DWD spec: CET up to 2000, UTC thereafter.
short_docstring_tokens: Parse dates according to typical DWD spec : CET up to 2000 UTC thereafter .
comment: """Parse dates according to typical DWD spec: CET up to 2000, UTC thereafter."""