|
6 | 6 |
|
7 | 7 | import numpy as np
|
8 | 8 |
|
9 |
| -from pandas._libs import NaT, Timestamp, algos as libalgos, lib, tslib, writers |
| 9 | +from pandas._libs import NaT, Timestamp, algos as libalgos, lib, writers |
10 | 10 | import pandas._libs.internals as libinternals
|
11 | 11 | from pandas._libs.tslibs import Timedelta, conversion
|
12 | 12 | from pandas._libs.tslibs.timezones import tz_compare
|
@@ -2116,21 +2116,13 @@ def _can_hold_element(self, element: Any) -> bool:
|
2116 | 2116 |
|
2117 | 2117 | return is_valid_nat_for_dtype(element, self.dtype)
|
2118 | 2118 |
|
2119 |
| - def to_native_types(self, na_rep=None, date_format=None, quoting=None, **kwargs): |
2120 |
| - """ convert to our native types format, slicing if desired """ |
2121 |
| - values = self.values |
2122 |
| - i8values = self.values.view("i8") |
2123 |
| - |
2124 |
| - from pandas.io.formats.format import _get_format_datetime64_from_values |
2125 |
| - |
2126 |
| - fmt = _get_format_datetime64_from_values(values, date_format) |
| 2119 | + def to_native_types(self, na_rep="NaT", date_format=None, **kwargs): |
| 2120 | + """ convert to our native types format """ |
| 2121 | + dta = self.array_values() |
2127 | 2122 |
|
2128 |
| - result = tslib.format_array_from_datetime( |
2129 |
| - i8values.ravel(), |
2130 |
| - tz=getattr(self.values, "tz", None), |
2131 |
| - format=fmt, |
2132 |
| - na_rep=na_rep, |
2133 |
| - ).reshape(i8values.shape) |
| 2123 | + result = dta._format_native_types( |
| 2124 | + na_rep=na_rep, date_format=date_format, **kwargs |
| 2125 | + ) |
2134 | 2126 | return np.atleast_2d(result)
|
2135 | 2127 |
|
2136 | 2128 | def set(self, locs, values):
|
|
0 commit comments