Skip to content

Commit b8d6d8c

Browse files
committed
Merge remote-tracking branch 'upstream/main' into enforce-pdep6
2 parents 6671ead + dcb5494 commit b8d6d8c

40 files changed

+332
-328
lines changed

.pre-commit-config.yaml

Lines changed: 4 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]
@@ -67,12 +67,13 @@ repos:
6767
- id: fix-encoding-pragma
6868
args: [--remove]
6969
- id: trailing-whitespace
70+
args: [--markdown-linebreak-ext=md]
7071
- repo: https://github.com/PyCQA/isort
7172
rev: 5.13.2
7273
hooks:
7374
- id: isort
7475
- repo: https://github.com/asottile/pyupgrade
75-
rev: v3.15.2
76+
rev: v3.16.0
7677
hooks:
7778
- id: pyupgrade
7879
args: [--py310-plus]
@@ -92,7 +93,7 @@ repos:
9293
- id: sphinx-lint
9394
args: ["--enable", "all", "--disable", "line-too-long"]
9495
- repo: https://github.com/pre-commit/mirrors-clang-format
95-
rev: v18.1.5
96+
rev: v18.1.8
9697
hooks:
9798
- id: clang-format
9899
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ Other API changes
230230
- 3rd party ``py.path`` objects are no longer explicitly supported in IO methods. Use :py:class:`pathlib.Path` objects instead (:issue:`57091`)
231231
- :func:`read_table`'s ``parse_dates`` argument defaults to ``None`` to improve consistency with :func:`read_csv` (:issue:`57476`)
232232
- Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`)
233+
- Passing a :class:`Series` input to :func:`json_normalize` will now retain the :class:`Series` :class:`Index`, previously output had a new :class:`RangeIndex` (:issue:`51452`)
233234
- Updated :meth:`DataFrame.to_excel` so that the output spreadsheet has no styling. Custom styling can still be done using :meth:`Styler.to_excel` (:issue:`54154`)
234235
- pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`)
235236
- pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`)
@@ -558,11 +559,12 @@ I/O
558559
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and ``byteorder=`big```. (:issue:`58969`)
559560
- Bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`)
560561
- Bug in :meth:`HDFStore.get` was failing to save data of dtype datetime64[s] correctly (:issue:`59004`)
562+
- Bug in :meth:`read_csv` causing segmentation fault when ``encoding_errors`` is not a string. (:issue:`59059`)
561563
- Bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
562564
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
563565
- 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`)
564567
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
565-
-
566568

567569
Period
568570
^^^^^^
@@ -594,11 +596,12 @@ Reshaping
594596
^^^^^^^^^
595597
- Bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
596598
- 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`)
597600

598601
Sparse
599602
^^^^^^
600603
- Bug in :class:`SparseDtype` for equal comparison with na fill value. (:issue:`54770`)
601-
-
604+
- Bug in :meth:`DataFrame.sparse.from_spmatrix` which hard coded an invalid ``fill_value`` for certain subtypes. (:issue:`59063`)
602605

603606
ExtensionArray
604607
^^^^^^^^^^^^^^
@@ -613,6 +616,7 @@ Other
613616
^^^^^
614617
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
615618
- 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`)
616620
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)
617621
- Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
618622
- 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/dtypes.pyx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,6 @@ class Resolution(Enum):
453453
"""
454454
cdef:
455455
str abbrev
456-
if freq in {"T", "t", "L", "l", "U", "u", "N", "n"}:
457-
raise ValueError(
458-
f"Frequency \'{freq}\' is no longer supported."
459-
)
460456
try:
461457
if freq in c_DEPR_ABBREVS:
462458
abbrev = c_DEPR_ABBREVS[freq]

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/timedeltas.pyi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ UnitChoices: TypeAlias = Literal[
3939
"minute",
4040
"min",
4141
"minutes",
42-
"T",
43-
"t",
4442
"s",
4543
"seconds",
4644
"sec",
@@ -50,21 +48,17 @@ UnitChoices: TypeAlias = Literal[
5048
"millisecond",
5149
"milli",
5250
"millis",
53-
"L",
54-
"l",
5551
"us",
5652
"microseconds",
5753
"microsecond",
5854
"µs",
5955
"micro",
6056
"micros",
61-
"u",
6257
"ns",
6358
"nanoseconds",
6459
"nano",
6560
"nanos",
6661
"nanosecond",
67-
"n",
6862
]
6963
_S = TypeVar("_S", bound=timedelta)
7064

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,11 +1818,6 @@ class Timedelta(_Timedelta):
18181818
* 'microseconds', 'microsecond', 'micros', 'micro', or 'us'
18191819
* 'nanoseconds', 'nanosecond', 'nanos', 'nano', or 'ns'.
18201820
1821-
.. deprecated:: 2.2.0
1822-
1823-
Values `H`, `T`, `S`, `L`, `U`, and `N` are deprecated in favour
1824-
of the values `h`, `min`, `s`, `ms`, `us`, and `ns`.
1825-
18261821
.. deprecated:: 3.0.0
18271822
18281823
Allowing the values `w`, `d`, `MIN`, `MS`, `US` and `NS` to denote units

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')

0 commit comments

Comments
 (0)