Skip to content

Commit 5fd86ad

Browse files
authored
Merge branch 'main' into issue-60365
2 parents f731062 + d067e08 commit 5fd86ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+402
-331
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.7.2
22+
rev: v0.8.1
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -47,7 +47,7 @@ repos:
4747
types_or: [python, rst, markdown, cython, c]
4848
additional_dependencies: [tomli]
4949
- repo: https://github.com/MarcoGorelli/cython-lint
50-
rev: v0.16.2
50+
rev: v0.16.6
5151
hooks:
5252
- id: cython-lint
5353
- id: double-quote-cython-strings
@@ -95,7 +95,7 @@ repos:
9595
- id: sphinx-lint
9696
args: ["--enable", "all", "--disable", "line-too-long"]
9797
- repo: https://github.com/pre-commit/mirrors-clang-format
98-
rev: v19.1.3
98+
rev: v19.1.4
9999
hooks:
100100
- id: clang-format
101101
files: ^pandas/_libs/src|^pandas/_libs/include

asv_bench/benchmarks/groupby.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,7 @@ def setup(self, dtype, method, application, ncols, engine):
511511
# grouping on multiple columns
512512
# and we lack kernels for a bunch of methods
513513
if (
514-
engine == "numba"
515-
and method in _numba_unsupported_methods
514+
(engine == "numba" and method in _numba_unsupported_methods)
516515
or ncols > 1
517516
or application == "transformation"
518517
or dtype == "datetime"

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ Indexing
667667
^^^^^^^^
668668
- Bug in :meth:`DataFrame.__getitem__` returning modified columns when called with ``slice`` in Python 3.12 (:issue:`57500`)
669669
- Bug in :meth:`DataFrame.from_records` throwing a ``ValueError`` when passed an empty list in ``index`` (:issue:`58594`)
670+
- Bug in :meth:`MultiIndex.insert` when a new value inserted to a datetime-like level gets cast to ``NaT`` and fails indexing (:issue:`60388`)
670671
- Bug in printing :attr:`Index.names` and :attr:`MultiIndex.levels` would not escape single quotes (:issue:`60190`)
671672

672673
Missing
@@ -700,6 +701,7 @@ I/O
700701
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
701702
- Bug in :meth:`read_csv` where the order of the ``na_values`` makes an inconsistency when ``na_values`` is a list non-string values. (:issue:`59303`)
702703
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
704+
- Bug in :meth:`read_html` where ``rowspan`` in header row causes incorrect conversion to ``DataFrame``. (:issue:`60210`)
703705
- Bug in :meth:`read_json` not validating the ``typ`` argument to not be exactly ``"frame"`` or ``"series"`` (:issue:`59124`)
704706
- Bug in :meth:`read_json` where extreme value integers in string format were incorrectly parsed as a different integer number (:issue:`20608`)
705707
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
@@ -736,6 +738,7 @@ Groupby/resample/rolling
736738
- Bug in :meth:`DataFrameGroupBy.cumsum` and :meth:`DataFrameGroupBy.cumprod` where ``numeric_only`` parameter was passed indirectly through kwargs instead of passing directly. (:issue:`58811`)
737739
- Bug in :meth:`DataFrameGroupBy.cumsum` where it did not return the correct dtype when the label contained ``None``. (:issue:`58811`)
738740
- Bug in :meth:`DataFrameGroupby.transform` and :meth:`SeriesGroupby.transform` with a reducer and ``observed=False`` that coerces dtype to float when there are unobserved categories. (:issue:`55326`)
741+
- Bug in :meth:`Rolling.apply` for ``method="table"`` where column order was not being respected due to the columns getting sorted by default. (:issue:`59666`)
739742
- Bug in :meth:`Rolling.apply` where the applied function could be called on fewer than ``min_period`` periods if ``method="table"``. (:issue:`58868`)
740743
- Bug in :meth:`Series.resample` could raise when the the date range ended shortly before a non-existent time. (:issue:`58380`)
741744

pandas/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@
235235
# Pandas is not (yet) a py.typed library: the public API is determined
236236
# based on the documentation.
237237
__all__ = [
238+
"NA",
238239
"ArrowDtype",
239240
"BooleanDtype",
240241
"Categorical",
@@ -253,15 +254,14 @@
253254
"HDFStore",
254255
"Index",
255256
"IndexSlice",
257+
"Int8Dtype",
256258
"Int16Dtype",
257259
"Int32Dtype",
258260
"Int64Dtype",
259-
"Int8Dtype",
260261
"Interval",
261262
"IntervalDtype",
262263
"IntervalIndex",
263264
"MultiIndex",
264-
"NA",
265265
"NaT",
266266
"NamedAgg",
267267
"Period",
@@ -274,10 +274,10 @@
274274
"Timedelta",
275275
"TimedeltaIndex",
276276
"Timestamp",
277+
"UInt8Dtype",
277278
"UInt16Dtype",
278279
"UInt32Dtype",
279280
"UInt64Dtype",
280-
"UInt8Dtype",
281281
"api",
282282
"array",
283283
"arrays",
@@ -290,8 +290,8 @@
290290
"errors",
291291
"eval",
292292
"factorize",
293-
"get_dummies",
294293
"from_dummies",
294+
"get_dummies",
295295
"get_option",
296296
"infer_freq",
297297
"interval_range",

pandas/_config/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
__all__ = [
1010
"config",
11+
"describe_option",
1112
"detect_console_encoding",
1213
"get_option",
13-
"set_option",
14-
"reset_option",
15-
"describe_option",
1614
"option_context",
1715
"options",
16+
"reset_option",
17+
"set_option",
1818
]
1919
from pandas._config import config
2020
from pandas._config import dates # pyright: ignore[reportUnusedImport] # noqa: F401

pandas/_libs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
__all__ = [
2+
"Interval",
23
"NaT",
34
"NaTType",
45
"OutOfBoundsDatetime",
56
"Period",
67
"Timedelta",
78
"Timestamp",
89
"iNaT",
9-
"Interval",
1010
]
1111

1212

pandas/_libs/tslibs/__init__.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
__all__ = [
2-
"dtypes",
3-
"localize_pydatetime",
2+
"BaseOffset",
3+
"IncompatibleFrequency",
44
"NaT",
55
"NaTType",
6-
"iNaT",
7-
"nat_strings",
86
"OutOfBoundsDatetime",
97
"OutOfBoundsTimedelta",
10-
"IncompatibleFrequency",
118
"Period",
129
"Resolution",
10+
"Tick",
1311
"Timedelta",
14-
"normalize_i8_timestamps",
15-
"is_date_array_normalized",
16-
"dt64arr_to_periodarr",
12+
"Timestamp",
13+
"add_overflowsafe",
14+
"astype_overflowsafe",
1715
"delta_to_nanoseconds",
16+
"dt64arr_to_periodarr",
17+
"dtypes",
18+
"get_resolution",
19+
"get_supported_dtype",
20+
"get_unit_from_dtype",
21+
"guess_datetime_format",
22+
"iNaT",
1823
"ints_to_pydatetime",
1924
"ints_to_pytimedelta",
20-
"get_resolution",
21-
"Timestamp",
22-
"tz_convert_from_utc_single",
23-
"tz_convert_from_utc",
24-
"to_offset",
25-
"Tick",
26-
"BaseOffset",
27-
"tz_compare",
25+
"is_date_array_normalized",
26+
"is_supported_dtype",
2827
"is_unitless",
29-
"astype_overflowsafe",
30-
"get_unit_from_dtype",
28+
"localize_pydatetime",
29+
"nat_strings",
30+
"normalize_i8_timestamps",
3131
"periods_per_day",
3232
"periods_per_second",
33-
"guess_datetime_format",
34-
"add_overflowsafe",
35-
"get_supported_dtype",
36-
"is_supported_dtype",
33+
"to_offset",
34+
"tz_compare",
35+
"tz_convert_from_utc",
36+
"tz_convert_from_utc_single",
3737
]
3838

3939
from pandas._libs.tslibs import dtypes

pandas/_testing/__init__.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,25 @@ def shares_memory(left, right) -> bool:
540540
"ALL_INT_NUMPY_DTYPES",
541541
"ALL_NUMPY_DTYPES",
542542
"ALL_REAL_NUMPY_DTYPES",
543+
"BOOL_DTYPES",
544+
"BYTES_DTYPES",
545+
"COMPLEX_DTYPES",
546+
"DATETIME64_DTYPES",
547+
"ENDIAN",
548+
"FLOAT_EA_DTYPES",
549+
"FLOAT_NUMPY_DTYPES",
550+
"NARROW_NP_DTYPES",
551+
"NP_NAT_OBJECTS",
552+
"NULL_OBJECTS",
553+
"OBJECT_DTYPES",
554+
"SIGNED_INT_EA_DTYPES",
555+
"SIGNED_INT_NUMPY_DTYPES",
556+
"STRING_DTYPES",
557+
"TIMEDELTA64_DTYPES",
558+
"UNSIGNED_INT_EA_DTYPES",
559+
"UNSIGNED_INT_NUMPY_DTYPES",
560+
"SubclassedDataFrame",
561+
"SubclassedSeries",
543562
"assert_almost_equal",
544563
"assert_attr_equal",
545564
"assert_categorical_equal",
@@ -563,51 +582,32 @@ def shares_memory(left, right) -> bool:
563582
"assert_sp_array_equal",
564583
"assert_timedelta_array_equal",
565584
"at",
566-
"BOOL_DTYPES",
567585
"box_expected",
568-
"BYTES_DTYPES",
569586
"can_set_locale",
570-
"COMPLEX_DTYPES",
571587
"convert_rows_list_to_csv_str",
572-
"DATETIME64_DTYPES",
573588
"decompress_file",
574-
"ENDIAN",
575589
"ensure_clean",
576590
"external_error_raised",
577-
"FLOAT_EA_DTYPES",
578-
"FLOAT_NUMPY_DTYPES",
579591
"get_cython_table_params",
580592
"get_dtype",
581-
"getitem",
582-
"get_locales",
583593
"get_finest_unit",
594+
"get_locales",
584595
"get_obj",
585596
"get_op_from_name",
597+
"getitem",
586598
"iat",
587599
"iloc",
588600
"loc",
589601
"maybe_produces_warning",
590-
"NARROW_NP_DTYPES",
591-
"NP_NAT_OBJECTS",
592-
"NULL_OBJECTS",
593-
"OBJECT_DTYPES",
594602
"raise_assert_detail",
595603
"raises_chained_assignment_error",
596604
"round_trip_pathlib",
597605
"round_trip_pickle",
598-
"setitem",
599606
"set_locale",
600607
"set_timezone",
608+
"setitem",
601609
"shares_memory",
602-
"SIGNED_INT_EA_DTYPES",
603-
"SIGNED_INT_NUMPY_DTYPES",
604-
"STRING_DTYPES",
605-
"SubclassedDataFrame",
606-
"SubclassedSeries",
607-
"TIMEDELTA64_DTYPES",
608610
"to_array",
609-
"UNSIGNED_INT_EA_DTYPES",
610-
"UNSIGNED_INT_NUMPY_DTYPES",
611611
"with_csv_dialect",
612612
"write_to_compressed",
613613
]

pandas/_testing/asserters.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,8 @@ def assert_extension_array_equal(
755755
and atol is lib.no_default
756756
):
757757
check_exact = (
758-
is_numeric_dtype(left.dtype)
759-
and not is_float_dtype(left.dtype)
760-
or is_numeric_dtype(right.dtype)
761-
and not is_float_dtype(right.dtype)
762-
)
758+
is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
759+
) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
763760
elif check_exact is lib.no_default:
764761
check_exact = False
765762

@@ -944,11 +941,8 @@ def assert_series_equal(
944941
and atol is lib.no_default
945942
):
946943
check_exact = (
947-
is_numeric_dtype(left.dtype)
948-
and not is_float_dtype(left.dtype)
949-
or is_numeric_dtype(right.dtype)
950-
and not is_float_dtype(right.dtype)
951-
)
944+
is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
945+
) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
952946
left_index_dtypes = (
953947
[left.index.dtype] if left.index.nlevels == 1 else left.index.dtypes
954948
)

pandas/_typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def mode(self) -> str:
273273
# for _get_filepath_or_buffer
274274
...
275275

276-
def seek(self, __offset: int, __whence: int = ...) -> int:
276+
def seek(self, offset: int, whence: int = ..., /) -> int:
277277
# with one argument: gzip.GzipFile, bz2.BZ2File
278278
# with two arguments: zip.ZipFile, read_sas
279279
...
@@ -288,13 +288,13 @@ def tell(self) -> int:
288288

289289

290290
class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
291-
def read(self, __n: int = ...) -> AnyStr_co:
291+
def read(self, n: int = ..., /) -> AnyStr_co:
292292
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
293293
...
294294

295295

296296
class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
297-
def write(self, __b: AnyStr_contra) -> Any:
297+
def write(self, b: AnyStr_contra, /) -> Any:
298298
# for gzip.GzipFile, bz2.BZ2File
299299
...
300300

0 commit comments

Comments
 (0)