Skip to content

Commit ea44792

Browse files
committed
fixup
1 parent 9aa0413 commit ea44792

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

doc/source/whatsnew/v0.24.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ Converting Timezone-Aware Series and Index to NumPy Arrays
12731273
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12741274

12751275
The conversion from a :class:`Series` or :class:`Index` with timezone-aware
1276-
datetime data will changing to preserve timezones by default (:issue:`23569`).
1276+
datetime data will change to preserve timezones by default (:issue:`23569`).
12771277

12781278
NumPy doesn't have a dedicated dtype for timezone-aware datetimes.
12791279
In the past, converting a :class:`Series` or :class:`DatetimeIndex` with
@@ -1292,7 +1292,7 @@ timezone attached
12921292
ser = pd.Series(pd.date_range('2000', periods=2, tz="CET"))
12931293
ser
12941294
1295-
The default behavior renames the same, but issues a warning
1295+
The default behavior remains the same, but issues a warning
12961296

12971297
.. code-block:: python
12981298

pandas/core/groupby/groupby.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class providing the base-class of operations.
2626

2727
from pandas.core.dtypes.cast import maybe_downcast_to_dtype
2828
from pandas.core.dtypes.common import (
29-
_NS_DTYPE, ensure_float, is_datetime64tz_dtype, is_extension_array_dtype,
30-
is_numeric_dtype, is_scalar)
29+
ensure_float, is_extension_array_dtype, is_numeric_dtype, is_scalar)
3130
from pandas.core.dtypes.missing import isna, notna
3231

3332
import pandas.core.algorithms as algorithms
@@ -1270,18 +1269,10 @@ def f(self, **kwargs):
12701269
return f
12711270

12721271
def first_compat(x, axis=0):
1273-
# This is a bit strange.
1274-
# We only hit this block when grouping a DatetimeTZBlock *and*
1275-
# a categorical. Something strange going on with first for
1276-
# categorical dta.
1277-
if is_datetime64tz_dtype(x.dtype):
1278-
dtype = _NS_DTYPE
1279-
else:
1280-
dtype = None
12811272

12821273
def first(x):
1274+
x = x.to_numpy()
12831275

1284-
x = np.asarray(x, dtype=dtype)
12851276
x = x[notna(x)]
12861277
if len(x) == 0:
12871278
return np.nan
@@ -1293,18 +1284,9 @@ def first(x):
12931284
return first(x)
12941285

12951286
def last_compat(x, axis=0):
1296-
# This is a bit strange.
1297-
# We only hit this block when grouping a DatetimeTZBlock *and*
1298-
# a categorical. Something strange going on with first for
1299-
# categorical dta.
1300-
if is_datetime64tz_dtype(x.dtype):
1301-
dtype = _NS_DTYPE
1302-
else:
1303-
dtype = None
13041287

13051288
def last(x):
1306-
1307-
x = np.asarray(x, dtype=dtype)
1289+
x = x.to_numpy()
13081290
x = x[notna(x)]
13091291
if len(x) == 0:
13101292
return np.nan

pandas/core/indexes/datetimes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ def _simple_new(cls, values, name=None, freq=None, tz=None, dtype=None):
340340
# --------------------------------------------------------------------
341341

342342
def __array__(self, dtype=None):
343-
if dtype is None and isinstance(self._data, DatetimeArray)\
344-
and getattr(self.dtype, 'tz', None):
343+
if (dtype is None and isinstance(self._data, DatetimeArray)
344+
and getattr(self.dtype, 'tz', None)):
345345
msg = (
346346
"Converting timezone-aware DatetimeArray to timezone-naive "
347347
"ndarray with 'datetime64[ns]' dtype. In the future, this "

0 commit comments

Comments
 (0)