Depending on underlying time resolution, arrow to_pydict() sometimes returns pd timestamp type (for nanosecond resolution), and sometimes you get standard python datetime (for microsecond resolution). While pd timestamp class is a subclass of python datetime, it doesn't always behav
(ts)
| 341 | |
| 342 | |
| 343 | def _coerce_datetime(ts): |
| 344 | """ |
| 345 | Depending on underlying time resolution, arrow to_pydict() sometimes returns pd |
| 346 | timestamp type (for nanosecond resolution), and sometimes you get standard python datetime |
| 347 | (for microsecond resolution). |
| 348 | While pd timestamp class is a subclass of python datetime, it doesn't always behave the |
| 349 | same way. We convert it to normal datetime so that consumers downstream don't have to deal |
| 350 | with these quirks. |
| 351 | """ |
| 352 | if isinstance(ts, pd.Timestamp): |
| 353 | return ts.to_pydatetime() |
| 354 | else: |
| 355 | return ts |
| 356 | |
| 357 | |
| 358 | def _columns_to_proto_values( |
no outgoing calls
no test coverage detected