(values, freq: BaseOffset)
| 247 | |
| 248 | @staticmethod |
| 249 | def _convert_1d(values, freq: BaseOffset): |
| 250 | valid_types = (str, datetime, Period, pydt.date, np.datetime64) |
| 251 | with warnings.catch_warnings(): |
| 252 | warnings.filterwarnings( |
| 253 | "ignore", "Period with BDay freq is deprecated", category=FutureWarning |
| 254 | ) |
| 255 | warnings.filterwarnings( |
| 256 | "ignore", r"PeriodDtype\[B\] is deprecated", category=FutureWarning |
| 257 | ) |
| 258 | if ( |
| 259 | isinstance(values, valid_types) |
| 260 | or is_integer(values) |
| 261 | or is_float(values) |
| 262 | ): |
| 263 | return _get_datevalue(values, freq) |
| 264 | elif isinstance(values, PeriodIndex): |
| 265 | return values.asfreq(freq).asi8 |
| 266 | elif isinstance(values, Index): |
| 267 | return values.map(lambda x: _get_datevalue(x, freq)) |
| 268 | elif lib.infer_dtype(values, skipna=False) == "period": |
| 269 | # https://github.com/pandas-dev/pandas/issues/24304 |
| 270 | # convert ndarray[period] -> PeriodIndex |
| 271 | return PeriodIndex(values, freq=freq).asi8 |
| 272 | elif isinstance(values, (list, tuple, np.ndarray)): |
| 273 | return [_get_datevalue(x, freq) for x in values] |
| 274 | return values |
| 275 | |
| 276 | |
| 277 | def _get_datevalue(date, freq: BaseOffset): |
no test coverage detected