Skip to content

Commit 83fc74d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into allow-times-and-not-adjust
2 parents f1d8a63 + 69fe98d commit 83fc74d

38 files changed

+302
-323
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ 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" \

doc/source/whatsnew/v3.0.0.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ Other API changes
231231
- 3rd party ``py.path`` objects are no longer explicitly supported in IO methods. Use :py:class:`pathlib.Path` objects instead (:issue:`57091`)
232232
- :func:`read_table`'s ``parse_dates`` argument defaults to ``None`` to improve consistency with :func:`read_csv` (:issue:`57476`)
233233
- Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`)
234+
- 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`)
234235
- 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`)
235236
- pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`)
236237
- pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`)
@@ -559,11 +560,12 @@ I/O
559560
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and ``byteorder=`big```. (:issue:`58969`)
560561
- Bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`)
561562
- Bug in :meth:`HDFStore.get` was failing to save data of dtype datetime64[s] correctly (:issue:`59004`)
563+
- Bug in :meth:`read_csv` causing segmentation fault when ``encoding_errors`` is not a string. (:issue:`59059`)
562564
- Bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
563565
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
564566
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
567+
- Bug in :meth:`read_json` not validating the ``typ`` argument to not be exactly ``"frame"`` or ``"series"`` (:issue:`59124`)
565568
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
566-
-
567569

568570
Period
569571
^^^^^^
@@ -595,11 +597,12 @@ Reshaping
595597
^^^^^^^^^
596598
- Bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
597599
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
600+
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
598601

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

604607
ExtensionArray
605608
^^^^^^^^^^^^^^
@@ -614,6 +617,7 @@ Other
614617
^^^^^
615618
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
616619
- Bug in :func:`eval` on :class:`ExtensionArray` on including division ``/`` failed with a ``TypeError``. (:issue:`58748`)
620+
- Bug in :func:`eval` on :class:`complex` including division ``/`` discards imaginary part. (:issue:`21374`)
617621
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)
618622
- Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
619623
- 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,21 @@ class NaTType(_NaT):
957957
"""
958958
Return new Timestamp object representing current time local to tz.
959959
960+
This method returns a new `Timestamp` object that represents the current time.
961+
If a timezone is provided, the current time will be localized to that timezone.
962+
Otherwise, it returns the current local time.
963+
960964
Parameters
961965
----------
962966
tz : str or timezone object, default None
963967
Timezone to localize to.
964968
969+
See Also
970+
--------
971+
to_datetime : Convert argument to datetime.
972+
Timestamp.utcnow : Return a new Timestamp representing UTC day and time.
973+
Timestamp.today : Return the current time in the local timezone.
974+
965975
Examples
966976
--------
967977
>>> 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: 10 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

0 commit comments

Comments
 (0)