(date_type, timestr)
| 270 | |
| 271 | |
| 272 | def _parse_iso8601(date_type, timestr): |
| 273 | default = date_type(1, 1, 1) |
| 274 | result = parse_iso8601_like(timestr) |
| 275 | replace = {} |
| 276 | |
| 277 | for attr in ["year", "month", "day", "hour", "minute", "second", "microsecond"]: |
| 278 | value = result.get(attr, None) |
| 279 | if value is not None: |
| 280 | resolution = attr |
| 281 | if attr == "microsecond": |
| 282 | if len(value) <= 3: |
| 283 | resolution = "millisecond" |
| 284 | # convert match string into valid microsecond value |
| 285 | value = 10 ** (6 - len(value)) * int(value) |
| 286 | replace[attr] = int(value) |
| 287 | return default.replace(**replace), resolution |
| 288 | |
| 289 | |
| 290 | def _maybe_strip_tz_from_timestamp(date: pd.Timestamp) -> pd.Timestamp: |
searching dependent graphs…