Skip to content

Commit ebfd576

Browse files
authored
Merge branch 'main' into ipython
2 parents 0613ae8 + e78ebd3 commit ebfd576

File tree

9 files changed

+52
-7
lines changed

9 files changed

+52
-7
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
100100
-i "pandas.Timedelta.max PR02" \
101101
-i "pandas.Timedelta.min PR02" \
102102
-i "pandas.Timedelta.resolution PR02" \
103-
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
104103
-i "pandas.Timestamp.max PR02" \
105104
-i "pandas.Timestamp.min PR02" \
106105
-i "pandas.Timestamp.nanosecond GL08" \
@@ -160,7 +159,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
160159
-i "pandas.errors.CSSWarning SA01" \
161160
-i "pandas.errors.CategoricalConversionWarning SA01" \
162161
-i "pandas.errors.ChainedAssignmentError SA01" \
163-
-i "pandas.errors.ClosedFileError SA01" \
164162
-i "pandas.errors.DataError SA01" \
165163
-i "pandas.errors.DuplicateLabelError SA01" \
166164
-i "pandas.errors.IntCastingNaNError SA01" \
@@ -170,7 +168,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
170168
-i "pandas.errors.NumExprClobberingError SA01" \
171169
-i "pandas.errors.NumbaUtilError SA01" \
172170
-i "pandas.errors.OptionError SA01" \
173-
-i "pandas.errors.OutOfBoundsDatetime SA01" \
174171
-i "pandas.errors.OutOfBoundsTimedelta SA01" \
175172
-i "pandas.errors.PerformanceWarning SA01" \
176173
-i "pandas.errors.PossibleDataLossError SA01" \

doc/source/user_guide/10min.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ See the indexing documentation :ref:`Indexing and Selecting Data <indexing>` and
177177
Getitem (``[]``)
178178
~~~~~~~~~~~~~~~~
179179

180-
For a :class:`DataFrame`, passing a single label selects a columns and
180+
For a :class:`DataFrame`, passing a single label selects a column and
181181
yields a :class:`Series` equivalent to ``df.A``:
182182

183183
.. ipython:: python

doc/source/user_guide/dsintro.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ index will be pulled out.
8787

8888
**From scalar value**
8989

90-
If ``data`` is a scalar value, an index must be
91-
provided. The value will be repeated to match the length of **index**.
90+
If ``data`` is a scalar value, the value will be repeated to match
91+
the length of **index**. If the **index** is not provided, it defaults
92+
to ``RangeIndex(1)``.
9293

9394
.. ipython:: python
9495

pandas/_libs/src/vendored/ujson/python/JSONtoObj.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ Numeric decoder derived from TCL library
3838

3939
// Licence at LICENSES/ULTRAJSON_LICENSE
4040

41-
#include "pandas/vendored/ujson/lib/ultrajson.h"
41+
// clang-format off
4242
#define PY_SSIZE_T_CLEAN
4343
#include <Python.h>
44+
#include "pandas/vendored/ujson/lib/ultrajson.h"
45+
// clang-format on
4446

4547
static int Object_objectAddKey(void *Py_UNUSED(prv), JSOBJ obj, JSOBJ name,
4648
JSOBJ value) {

pandas/_libs/tslibs/nattype.pyx

+2
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ class NaTType(_NaT):
500500
--------
501501
to_timedelta : Convert argument to timedelta.
502502
Timedelta : Represents a duration, the difference between two dates or times.
503+
Timedelta.seconds : Returns the seconds component of the timedelta.
504+
Timedelta.microseconds : Returns the microseconds component of the timedelta.
503505
504506
Examples
505507
--------

pandas/_libs/tslibs/np_datetime.pyx

+9
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ class OutOfBoundsDatetime(ValueError):
176176
"""
177177
Raised when the datetime is outside the range that can be represented.
178178
179+
This error occurs when attempting to convert or parse a datetime value
180+
that exceeds the bounds supported by pandas' internal datetime
181+
representation.
182+
183+
See Also
184+
--------
185+
to_datetime : Convert argument to datetime.
186+
Timestamp : Pandas replacement for python ``datetime.datetime`` object.
187+
179188
Examples
180189
--------
181190
>>> pd.to_datetime("08335394550")

pandas/_libs/tslibs/timedeltas.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,8 @@ cdef class _Timedelta(timedelta):
11961196
--------
11971197
to_timedelta : Convert argument to timedelta.
11981198
Timedelta : Represents a duration, the difference between two dates or times.
1199+
Timedelta.seconds : Returns the seconds component of the timedelta.
1200+
Timedelta.microseconds : Returns the microseconds component of the timedelta.
11991201

12001202
Examples
12011203
--------
@@ -1493,6 +1495,7 @@ cdef class _Timedelta(timedelta):
14931495
14941496
See Also
14951497
--------
1498+
Timedelta.asm8 : Return a numpy timedelta64 array scalar view.
14961499
numpy.ndarray.view : Returns a view of an array with the same data.
14971500
Timedelta.to_numpy : Converts the Timedelta to a NumPy timedelta64.
14981501
Timedelta.total_seconds : Returns the total duration of the Timedelta

pandas/core/arrays/timedeltas.py

+21
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,19 @@ def to_pytimedelta(self) -> npt.NDArray[np.object_]:
790790
Returns
791791
-------
792792
numpy.ndarray
793+
A NumPy ``timedelta64`` object representing the same duration as the
794+
original pandas ``Timedelta`` object. The precision of the resulting
795+
object is in nanoseconds, which is the default
796+
time resolution used by pandas for ``Timedelta`` objects, ensuring
797+
high precision for time-based calculations.
798+
799+
See Also
800+
--------
801+
to_timedelta : Convert argument to timedelta format.
802+
Timedelta : Represents a duration between two dates or times.
803+
DatetimeIndex: Index of datetime64 data.
804+
Timedelta.components : Return a components namedtuple-like
805+
of a single timedelta.
793806
794807
Examples
795808
--------
@@ -800,6 +813,14 @@ def to_pytimedelta(self) -> npt.NDArray[np.object_]:
800813
>>> tdelta_idx.to_pytimedelta()
801814
array([datetime.timedelta(days=1), datetime.timedelta(days=2),
802815
datetime.timedelta(days=3)], dtype=object)
816+
817+
>>> tidx = pd.TimedeltaIndex(data=["1 days 02:30:45", "3 days 04:15:10"])
818+
>>> tidx
819+
TimedeltaIndex(['1 days 02:30:45', '3 days 04:15:10'],
820+
dtype='timedelta64[ns]', freq=None)
821+
>>> tidx.to_pytimedelta()
822+
array([datetime.timedelta(days=1, seconds=9045),
823+
datetime.timedelta(days=3, seconds=15310)], dtype=object)
803824
"""
804825
return ints_to_pytimedelta(self._ndarray)
805826

pandas/errors/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,16 @@ class ClosedFileError(Exception):
615615
"""
616616
Exception is raised when trying to perform an operation on a closed HDFStore file.
617617
618+
``ClosedFileError`` is specific to operations on ``HDFStore`` objects. Once an
619+
HDFStore is closed, its resources are no longer available, and any further attempt
620+
to access data or perform file operations will raise this exception.
621+
622+
See Also
623+
--------
624+
HDFStore.close : Closes the PyTables file handle.
625+
HDFStore.open : Opens the file in the specified mode.
626+
HDFStore.is_open : Returns a boolean indicating whether the file is open.
627+
618628
Examples
619629
--------
620630
>>> store = pd.HDFStore("my-store", "a") # doctest: +SKIP

0 commit comments

Comments
 (0)