Skip to content

Commit f99aa47

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ref/concat
2 parents adbce63 + dcb5494 commit f99aa47

File tree

27 files changed

+242
-244
lines changed

27 files changed

+242
-244
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ci:
1919
skip: [pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.4.7
22+
rev: v0.5.0
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -73,7 +73,7 @@ repos:
7373
hooks:
7474
- id: isort
7575
- repo: https://github.com/asottile/pyupgrade
76-
rev: v3.15.2
76+
rev: v3.16.0
7777
hooks:
7878
- id: pyupgrade
7979
args: [--py310-plus]
@@ -93,7 +93,7 @@ repos:
9393
- id: sphinx-lint
9494
args: ["--enable", "all", "--disable", "line-too-long"]
9595
- repo: https://github.com/pre-commit/mirrors-clang-format
96-
rev: v18.1.5
96+
rev: v18.1.8
9797
hooks:
9898
- id: clang-format
9999
files: ^pandas/_libs/src|^pandas/_libs/include

ci/code_checks.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
244244
-i "pandas.Timestamp.month_name SA01" \
245245
-i "pandas.Timestamp.nanosecond GL08" \
246246
-i "pandas.Timestamp.normalize SA01" \
247-
-i "pandas.Timestamp.now SA01" \
248247
-i "pandas.Timestamp.quarter SA01" \
249248
-i "pandas.Timestamp.replace PR07,SA01" \
250249
-i "pandas.Timestamp.resolution PR02" \
251250
-i "pandas.Timestamp.second GL08" \
252251
-i "pandas.Timestamp.strptime PR01,SA01" \
253-
-i "pandas.Timestamp.time SA01" \
254252
-i "pandas.Timestamp.timestamp SA01" \
255253
-i "pandas.Timestamp.timetuple SA01" \
256254
-i "pandas.Timestamp.timetz SA01" \

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ I/O
563563
- Bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
564564
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
565565
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
566+
- Bug in :meth:`read_json` not validating the ``typ`` argument to not be exactly ``"frame"`` or ``"series"`` (:issue:`59124`)
566567
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
567-
-
568568

569569
Period
570570
^^^^^^
@@ -596,6 +596,7 @@ Reshaping
596596
^^^^^^^^^
597597
- Bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
598598
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
599+
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
599600

600601
Sparse
601602
^^^^^^
@@ -615,6 +616,7 @@ Other
615616
^^^^^
616617
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
617618
- Bug in :func:`eval` on :class:`ExtensionArray` on including division ``/`` failed with a ``TypeError``. (:issue:`58748`)
619+
- Bug in :func:`eval` on :class:`complex` including division ``/`` discards imaginary part. (:issue:`21374`)
618620
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)
619621
- Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
620622
- Bug in :meth:`DataFrame.apply` where passing ``engine="numba"`` ignored ``args`` passed to the applied function (:issue:`58712`)

pandas/_libs/src/datetime/pd_datetime.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@ static int pandas_datetime_exec(PyObject *Py_UNUSED(module)) {
245245
}
246246

247247
static PyModuleDef_Slot pandas_datetime_slots[] = {
248-
{Py_mod_exec, pandas_datetime_exec}, {0, NULL}};
248+
{Py_mod_exec, pandas_datetime_exec},
249+
#if PY_VERSION_HEX >= 0x030D0000
250+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
251+
#endif
252+
{0, NULL},
253+
};
249254

250255
static struct PyModuleDef pandas_datetimemodule = {
251256
PyModuleDef_HEAD_INIT,

pandas/_libs/src/parser/pd_parser.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ static int pandas_parser_exec(PyObject *Py_UNUSED(module)) {
161161
}
162162

163163
static PyModuleDef_Slot pandas_parser_slots[] = {
164-
{Py_mod_exec, pandas_parser_exec}, {0, NULL}};
164+
{Py_mod_exec, pandas_parser_exec},
165+
#if PY_VERSION_HEX >= 0x030D0000
166+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
167+
#endif
168+
{0, NULL},
169+
};
165170

166171
static struct PyModuleDef pandas_parsermodule = {
167172
PyModuleDef_HEAD_INIT,

pandas/_libs/tslibs/nattype.pyx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,16 @@ class NaTType(_NaT):
633633
"""
634634
Return time object with same time but with tzinfo=None.
635635
636+
This method extracts the time part of the `Timestamp` object, excluding any
637+
timezone information. It returns a `datetime.time` object which only represents
638+
the time (hours, minutes, seconds, and microseconds).
639+
640+
See Also
641+
--------
642+
Timestamp.date : Return date object with same year, month and day.
643+
Timestamp.tz_convert : Convert timezone-aware Timestamp to another time zone.
644+
Timestamp.tz_localize : Localize the Timestamp to a timezone.
645+
636646
Examples
637647
--------
638648
>>> ts = pd.Timestamp('2023-01-01 10:00:00')
@@ -957,11 +967,21 @@ class NaTType(_NaT):
957967
"""
958968
Return new Timestamp object representing current time local to tz.
959969
970+
This method returns a new `Timestamp` object that represents the current time.
971+
If a timezone is provided, the current time will be localized to that timezone.
972+
Otherwise, it returns the current local time.
973+
960974
Parameters
961975
----------
962976
tz : str or timezone object, default None
963977
Timezone to localize to.
964978
979+
See Also
980+
--------
981+
to_datetime : Convert argument to datetime.
982+
Timestamp.utcnow : Return a new Timestamp representing UTC day and time.
983+
Timestamp.today : Return the current time in the local timezone.
984+
965985
Examples
966986
--------
967987
>>> pd.Timestamp.now() # doctest: +SKIP

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,11 +1465,21 @@ class Timestamp(_Timestamp):
14651465
"""
14661466
Return new Timestamp object representing current time local to tz.
14671467
1468+
This method returns a new `Timestamp` object that represents the current time.
1469+
If a timezone is provided, the current time will be localized to that timezone.
1470+
Otherwise, it returns the current local time.
1471+
14681472
Parameters
14691473
----------
14701474
tz : str or timezone object, default None
14711475
Timezone to localize to.
14721476
1477+
See Also
1478+
--------
1479+
to_datetime : Convert argument to datetime.
1480+
Timestamp.utcnow : Return a new Timestamp representing UTC day and time.
1481+
Timestamp.today : Return the current time in the local timezone.
1482+
14731483
Examples
14741484
--------
14751485
>>> pd.Timestamp.now() # doctest: +SKIP
@@ -1768,6 +1778,16 @@ class Timestamp(_Timestamp):
17681778
"""
17691779
Return time object with same time but with tzinfo=None.
17701780
1781+
This method extracts the time part of the `Timestamp` object, excluding any
1782+
timezone information. It returns a `datetime.time` object which only represents
1783+
the time (hours, minutes, seconds, and microseconds).
1784+
1785+
See Also
1786+
--------
1787+
Timestamp.date : Return date object with same year, month and day.
1788+
Timestamp.tz_convert : Convert timezone-aware Timestamp to another time zone.
1789+
Timestamp.tz_localize : Localize the Timestamp to a timezone.
1790+
17711791
Examples
17721792
--------
17731793
>>> ts = pd.Timestamp('2023-01-01 10:00:00')

pandas/_testing/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107

108108
COMPLEX_DTYPES: list[Dtype] = [complex, "complex64", "complex128"]
109109
STRING_DTYPES: list[Dtype] = [str, "str", "U"]
110+
COMPLEX_FLOAT_DTYPES: list[Dtype] = [*COMPLEX_DTYPES, *FLOAT_NUMPY_DTYPES]
110111

111112
DATETIME64_DTYPES: list[Dtype] = ["datetime64[ns]", "M8[ns]"]
112113
TIMEDELTA64_DTYPES: list[Dtype] = ["timedelta64[ns]", "m8[ns]"]

pandas/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,21 @@ def complex_dtype(request):
14481448
return request.param
14491449

14501450

1451+
@pytest.fixture(params=tm.COMPLEX_FLOAT_DTYPES)
1452+
def complex_or_float_dtype(request):
1453+
"""
1454+
Parameterized fixture for complex and numpy float dtypes.
1455+
1456+
* complex
1457+
* 'complex64'
1458+
* 'complex128'
1459+
* float
1460+
* 'float32'
1461+
* 'float64'
1462+
"""
1463+
return request.param
1464+
1465+
14511466
@pytest.fixture(params=tm.SIGNED_INT_NUMPY_DTYPES)
14521467
def any_signed_int_numpy_dtype(request):
14531468
"""

pandas/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def is_bool_indexer(key: Any) -> bool:
145145
elif isinstance(key, list):
146146
# check if np.array(key).dtype would be bool
147147
if len(key) > 0:
148-
if type(key) is not list: # noqa: E721
148+
if type(key) is not list:
149149
# GH#42461 cython will raise TypeError if we pass a subclass
150150
key = list(key)
151151
return lib.is_bool_list(key)

0 commit comments

Comments
 (0)