Make x and new_x float. This is particularly useful for datetime dtype.
(
x: list[Variable], new_x: list[Variable]
)
| 595 | |
| 596 | |
| 597 | def _floatize_x( |
| 598 | x: list[Variable], new_x: list[Variable] |
| 599 | ) -> tuple[list[Variable], list[Variable]]: |
| 600 | """Make x and new_x float. |
| 601 | This is particularly useful for datetime dtype. |
| 602 | """ |
| 603 | for i in range(len(x)): |
| 604 | if _contains_datetime_like_objects(x[i]): |
| 605 | # Scipy casts coordinates to np.float64, which is not accurate |
| 606 | # enough for datetime64 (uses 64bit integer). |
| 607 | # We assume that the most of the bits are used to represent the |
| 608 | # offset (min(x)) and the variation (x - min(x)) can be |
| 609 | # represented by float. |
| 610 | xmin = x[i].values.min() |
| 611 | x[i] = x[i]._to_numeric(offset=xmin, dtype=np.float64) |
| 612 | new_x[i] = new_x[i]._to_numeric(offset=xmin, dtype=np.float64) |
| 613 | return x, new_x |
| 614 | |
| 615 | |
| 616 | def interp( |
no test coverage detected
searching dependent graphs…