File tree Expand file tree Collapse file tree 1 file changed +1
-39
lines changed
Expand file tree Collapse file tree 1 file changed +1
-39
lines changed Original file line number Diff line number Diff line change 4646 is_integer_dtype ,
4747 is_interval_dtype ,
4848 is_numeric_dtype ,
49- is_object_dtype ,
5049 is_scalar ,
5150 needs_i8_conversion ,
5251)
@@ -1283,7 +1282,7 @@ def _wrap_applied_output_series(
12831282 # as we are stacking can easily have object dtypes here
12841283 so = self ._selected_obj
12851284 if so .ndim == 2 and so .dtypes .apply (needs_i8_conversion ).any ():
1286- result = _recast_datetimelike_result ( result )
1285+ result = result . _convert ( datetime = True )
12871286 else :
12881287 result = result ._convert (datetime = True )
12891288
@@ -1836,40 +1835,3 @@ def nunique(self, dropna: bool = True) -> DataFrame:
18361835 return results
18371836
18381837 boxplot = boxplot_frame_groupby
1839-
1840-
1841- def _recast_datetimelike_result (result : DataFrame ) -> DataFrame :
1842- """
1843- If we have date/time like in the original, then coerce dates
1844- as we are stacking can easily have object dtypes here.
1845-
1846- Parameters
1847- ----------
1848- result : DataFrame
1849-
1850- Returns
1851- -------
1852- DataFrame
1853-
1854- Notes
1855- -----
1856- - Assumes Groupby._selected_obj has ndim==2 and at least one
1857- datetimelike column
1858- """
1859- result = result .copy ()
1860-
1861- obj_cols = [
1862- idx
1863- for idx in range (len (result .columns ))
1864- if is_object_dtype (result .dtypes .iloc [idx ])
1865- ]
1866-
1867- # See GH#26285
1868- for n in obj_cols :
1869- values = result .iloc [:, n ].values
1870- converted = lib .maybe_convert_objects (
1871- values , convert_datetime = True , convert_timedelta = True
1872- )
1873-
1874- result .iloc [:, n ] = converted
1875- return result
You can’t perform that action at this time.
0 commit comments