Skip to content

Commit 38d545c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pivot
* upstream/master: BUG: Fix passing of numeric_only argument for categorical reduce (pandas-dev#25304) ENH: Support times with timezones in at_time (pandas-dev#25280) COMPAT: alias .to_numpy() for timestamp and timedelta scalars (pandas-dev#25142) DOC/CLN: Fix various docstring errors (pandas-dev#25295) Bug: OverflowError in resample.agg with tz data (pandas-dev#25297) Fixes Formatting Exception (pandas-dev#25088) BUG: groupby.transform retains timezone information (pandas-dev#25264) Doc: corrects spelling in generic.py (pandas-dev#25333) Fix typos in docs (pandas-dev#25305)
2 parents ad4a761 + 29008f5 commit 38d545c

31 files changed

+456
-244
lines changed

doc/source/reference/arrays.rst

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Methods
120120
Timestamp.timetuple
121121
Timestamp.timetz
122122
Timestamp.to_datetime64
123+
Timestamp.to_numpy
123124
Timestamp.to_julian_date
124125
Timestamp.to_period
125126
Timestamp.to_pydatetime
@@ -191,6 +192,7 @@ Methods
191192
Timedelta.round
192193
Timedelta.to_pytimedelta
193194
Timedelta.to_timedelta64
195+
Timedelta.to_numpy
194196
Timedelta.total_seconds
195197

196198
A collection of timedeltas may be stored in a :class:`TimedeltaArray`.

doc/source/user_guide/groupby.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ arbitrary function, for example:
13171317
df.groupby(['Store', 'Product']).pipe(mean)
13181318
13191319
where ``mean`` takes a GroupBy object and finds the mean of the Revenue and Quantity
1320-
columns repectively for each Store-Product combination. The ``mean`` function can
1320+
columns respectively for each Store-Product combination. The ``mean`` function can
13211321
be any function that takes in a GroupBy object; the ``.pipe`` will pass the GroupBy
13221322
object as a parameter into the function you specify.
13231323

doc/source/whatsnew/v0.10.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ Updated PyTables Support
370370
df1.get_dtype_counts()
371371
372372
- performance improvements on table writing
373-
- support for arbitrarly indexed dimensions
373+
- support for arbitrarily indexed dimensions
374374
- ``SparseSeries`` now has a ``density`` property (:issue:`2384`)
375375
- enable ``Series.str.strip/lstrip/rstrip`` methods to take an input argument
376376
to strip arbitrary characters (:issue:`2411`)

doc/source/whatsnew/v0.16.1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ groupby operations on the index will preserve the index nature as well
136136
reindexing operations, will return a resulting index based on the type of the passed
137137
indexer, meaning that passing a list will return a plain-old-``Index``; indexing with
138138
a ``Categorical`` will return a ``CategoricalIndex``, indexed according to the categories
139-
of the PASSED ``Categorical`` dtype. This allows one to arbitrarly index these even with
139+
of the PASSED ``Categorical`` dtype. This allows one to arbitrarily index these even with
140140
values NOT in the categories, similarly to how you can reindex ANY pandas index.
141141

142142
.. code-block:: ipython

doc/source/whatsnew/v0.24.2.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Fixed Regressions
2525
- Fixed regression in :meth:`DataFrame.apply` causing ``RecursionError`` when ``dict``-like classes were passed as argument. (:issue:`25196`)
2626

2727
- Fixed regression in :meth:`DataFrame.duplicated()`, where empty dataframe was not returning a boolean dtyped Series. (:issue:`25184`)
28+
- Fixed regression in :meth:`Series.min` and :meth:`Series.max` where ``numeric_only=True`` was ignored when the ``Series`` contained ```Categorical`` data (:issue:`25299`)
2829

2930
.. _whatsnew_0242.enhancements:
3031

@@ -53,6 +54,7 @@ Bug Fixes
5354

5455
**I/O**
5556

57+
- Better handling of terminal printing when the terminal dimensions are not known (:issue:`25080`);
5658
- Bug in reading a HDF5 table-format ``DataFrame`` created in Python 2, in Python 3 (:issue:`24925`)
5759
- Bug in reading a JSON with ``orient='table'`` generated by :meth:`DataFrame.to_json` with ``index=False`` (:issue:`25170`)
5860
- Bug where float indexes could have misaligned values when printing (:issue:`25061`)
@@ -78,7 +80,7 @@ Bug Fixes
7880

7981
**Reshaping**
8082

81-
-
83+
- Bug in :meth:`pandas.core.groupby.GroupBy.transform` where applying a function to a timezone aware column would return a timezone naive result (:issue:`24198`)
8284
- Bug in :func:`DataFrame.join` when joining on a timezone aware :class:`DatetimeIndex` (:issue:`23931`)
8385
-
8486

doc/source/whatsnew/v0.25.0.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Other Enhancements
2020
^^^^^^^^^^^^^^^^^^
2121

2222
- :meth:`Timestamp.replace` now supports the ``fold`` argument to disambiguate DST transition times (:issue:`25017`)
23-
- :meth:`DataFrame.pivot` now supports multiple column indexes (:issue:`21425`)
24-
-
23+
- :meth:`DataFrame.at_time` and :meth:`Series.at_time` now support :meth:`datetime.time` objects with timezones (:issue:`24043`)
24+
- :meth:`DataFrame.pivot` now supports multiple column indexes by accepting a list of columns (:issue:`21425`)
2525

2626
.. _whatsnew_0250.api_breaking:
2727

@@ -34,6 +34,7 @@ Other API Changes
3434
^^^^^^^^^^^^^^^^^
3535

3636
- :class:`DatetimeTZDtype` will now standardize pytz timezones to a common timezone instance (:issue:`24713`)
37+
- ``Timestamp`` and ``Timedelta`` scalars now implement the :meth:`to_numpy` method as aliases to :meth:`Timestamp.to_datetime64` and :meth:`Timedelta.to_timedelta64`, respectively. (:issue:`24653`)
3738
-
3839
-
3940

@@ -172,7 +173,7 @@ Plotting
172173
Groupby/Resample/Rolling
173174
^^^^^^^^^^^^^^^^^^^^^^^^
174175

175-
-
176+
- Bug in :meth:`pandas.core.resample.Resampler.agg` with a timezone aware index where ``OverflowError`` would raise when passing a list of functions (:issue:`22660`)
176177
-
177178
-
178179

pandas/_libs/tslibs/nattype.pyx

+20
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,26 @@ cdef class _NaT(datetime):
188188
"""
189189
return np.datetime64('NaT', 'ns')
190190

191+
def to_numpy(self, dtype=None, copy=False):
192+
"""
193+
Convert the Timestamp to a NumPy datetime64.
194+
195+
.. versionadded:: 0.25.0
196+
197+
This is an alias method for `Timestamp.to_datetime64()`. The dtype and
198+
copy parameters are available here only for compatibility. Their values
199+
will not affect the return value.
200+
201+
Returns
202+
-------
203+
numpy.datetime64
204+
205+
See Also
206+
--------
207+
DatetimeIndex.to_numpy : Similar method for DatetimeIndex.
208+
"""
209+
return self.to_datetime64()
210+
191211
def __repr__(self):
192212
return 'NaT'
193213

pandas/_libs/tslibs/timedeltas.pyx

+20
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,26 @@ cdef class _Timedelta(timedelta):
824824
""" Returns a numpy.timedelta64 object with 'ns' precision """
825825
return np.timedelta64(self.value, 'ns')
826826

827+
def to_numpy(self, dtype=None, copy=False):
828+
"""
829+
Convert the Timestamp to a NumPy timedelta64.
830+
831+
.. versionadded:: 0.25.0
832+
833+
This is an alias method for `Timedelta.to_timedelta64()`. The dtype and
834+
copy parameters are available here only for compatibility. Their values
835+
will not affect the return value.
836+
837+
Returns
838+
-------
839+
numpy.timedelta64
840+
841+
See Also
842+
--------
843+
Series.to_numpy : Similar method for Series.
844+
"""
845+
return self.to_timedelta64()
846+
827847
def total_seconds(self):
828848
"""
829849
Total duration of timedelta in seconds (to ns precision)

pandas/_libs/tslibs/timestamps.pyx

+20
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,26 @@ cdef class _Timestamp(datetime):
345345
"""
346346
return np.datetime64(self.value, 'ns')
347347

348+
def to_numpy(self, dtype=None, copy=False):
349+
"""
350+
Convert the Timestamp to a NumPy datetime64.
351+
352+
.. versionadded:: 0.25.0
353+
354+
This is an alias method for `Timestamp.to_datetime64()`. The dtype and
355+
copy parameters are available here only for compatibility. Their values
356+
will not affect the return value.
357+
358+
Returns
359+
-------
360+
numpy.datetime64
361+
362+
See Also
363+
--------
364+
DatetimeIndex.to_numpy : Similar method for DatetimeIndex.
365+
"""
366+
return self.to_datetime64()
367+
348368
def __add__(self, other):
349369
cdef:
350370
int64_t other_int, nanos

0 commit comments

Comments
 (0)