Skip to content

Commit 2437ce2

Browse files
committed
Merge branch 'main' into add-mask-fillna
2 parents 5516517 + bc24e84 commit 2437ce2

File tree

15 files changed

+115
-31
lines changed

15 files changed

+115
-31
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ COPY requirements-dev.txt /tmp
1313
RUN python -m pip install -r /tmp/requirements-dev.txt
1414
RUN git config --global --add safe.directory /home/pandas
1515

16-
ENV SHELL "/bin/bash"
16+
ENV SHELL="/bin/bash"
1717
CMD ["/bin/bash"]

doc/source/getting_started/overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,4 @@ License
174174
-------
175175

176176
.. literalinclude:: ../../../LICENSE
177+
:language: none

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ Indexing
696696
- Bug in :meth:`DataFrame.__getitem__` returning modified columns when called with ``slice`` in Python 3.12 (:issue:`57500`)
697697
- Bug in :meth:`DataFrame.from_records` throwing a ``ValueError`` when passed an empty list in ``index`` (:issue:`58594`)
698698
- Bug in :meth:`DataFrame.loc` with inconsistent behavior of loc-set with 2 given indexes to Series (:issue:`59933`)
699+
- Bug in :meth:`Index.get_indexer` and similar methods when ``NaN`` is located at or after position 128 (:issue:`58924`)
699700
- Bug in :meth:`MultiIndex.insert` when a new value inserted to a datetime-like level gets cast to ``NaT`` and fails indexing (:issue:`60388`)
700701
- Bug in :meth:`Series.mask` unexpectedly filling ``pd.NA`` (:issue:`60729`)
701702
- Bug in printing :attr:`Index.names` and :attr:`MultiIndex.levels` would not escape single quotes (:issue:`60190`)
@@ -719,6 +720,7 @@ I/O
719720
^^^
720721
- Bug in :class:`DataFrame` and :class:`Series` ``repr`` of :py:class:`collections.abc.Mapping`` elements. (:issue:`57915`)
721722
- Bug in :meth:`.DataFrame.to_json` when ``"index"`` was a value in the :attr:`DataFrame.column` and :attr:`Index.name` was ``None``. Now, this will fail with a ``ValueError`` (:issue:`58925`)
723+
- Bug in :meth:`.io.common.is_fsspec_url` not recognizing chained fsspec URLs (:issue:`48978`)
722724
- Bug in :meth:`DataFrame._repr_html_` which ignored the ``"display.float_format"`` option (:issue:`59876`)
723725
- Bug in :meth:`DataFrame.from_records` where ``columns`` parameter with numpy structured array was not reordering and filtering out the columns (:issue:`59717`)
724726
- Bug in :meth:`DataFrame.to_dict` raises unnecessary ``UserWarning`` when columns are not unique and ``orient='tight'``. (:issue:`58281`)
@@ -787,6 +789,7 @@ Reshaping
787789
- Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an ``index`` argument (:issue:`58722`)
788790
- Bug in :meth:`DataFrame.stack` with the new implementation where ``ValueError`` is raised when ``level=[]`` (:issue:`60740`)
789791
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
792+
- Bug in :meth:`concat` where concatenating DataFrame and Series with ``ignore_index = True`` drops the series name (:issue:`60723`, :issue:`56257`)
790793

791794
Sparse
792795
^^^^^^

pandas/_libs/hashtable.pxd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cdef class HashTable:
4141

4242
cdef class UInt64HashTable(HashTable):
4343
cdef kh_uint64_t *table
44-
cdef int64_t na_position
44+
cdef Py_ssize_t na_position
4545
cdef bint uses_mask
4646

4747
cpdef get_item(self, uint64_t val)
@@ -51,7 +51,7 @@ cdef class UInt64HashTable(HashTable):
5151

5252
cdef class Int64HashTable(HashTable):
5353
cdef kh_int64_t *table
54-
cdef int64_t na_position
54+
cdef Py_ssize_t na_position
5555
cdef bint uses_mask
5656

5757
cpdef get_item(self, int64_t val)
@@ -61,7 +61,7 @@ cdef class Int64HashTable(HashTable):
6161

6262
cdef class UInt32HashTable(HashTable):
6363
cdef kh_uint32_t *table
64-
cdef int64_t na_position
64+
cdef Py_ssize_t na_position
6565
cdef bint uses_mask
6666

6767
cpdef get_item(self, uint32_t val)
@@ -71,7 +71,7 @@ cdef class UInt32HashTable(HashTable):
7171

7272
cdef class Int32HashTable(HashTable):
7373
cdef kh_int32_t *table
74-
cdef int64_t na_position
74+
cdef Py_ssize_t na_position
7575
cdef bint uses_mask
7676

7777
cpdef get_item(self, int32_t val)
@@ -81,7 +81,7 @@ cdef class Int32HashTable(HashTable):
8181

8282
cdef class UInt16HashTable(HashTable):
8383
cdef kh_uint16_t *table
84-
cdef int64_t na_position
84+
cdef Py_ssize_t na_position
8585
cdef bint uses_mask
8686

8787
cpdef get_item(self, uint16_t val)
@@ -91,7 +91,7 @@ cdef class UInt16HashTable(HashTable):
9191

9292
cdef class Int16HashTable(HashTable):
9393
cdef kh_int16_t *table
94-
cdef int64_t na_position
94+
cdef Py_ssize_t na_position
9595
cdef bint uses_mask
9696

9797
cpdef get_item(self, int16_t val)
@@ -101,7 +101,7 @@ cdef class Int16HashTable(HashTable):
101101

102102
cdef class UInt8HashTable(HashTable):
103103
cdef kh_uint8_t *table
104-
cdef int64_t na_position
104+
cdef Py_ssize_t na_position
105105
cdef bint uses_mask
106106

107107
cpdef get_item(self, uint8_t val)
@@ -111,7 +111,7 @@ cdef class UInt8HashTable(HashTable):
111111

112112
cdef class Int8HashTable(HashTable):
113113
cdef kh_int8_t *table
114-
cdef int64_t na_position
114+
cdef Py_ssize_t na_position
115115
cdef bint uses_mask
116116

117117
cpdef get_item(self, int8_t val)
@@ -121,7 +121,7 @@ cdef class Int8HashTable(HashTable):
121121

122122
cdef class Float64HashTable(HashTable):
123123
cdef kh_float64_t *table
124-
cdef int64_t na_position
124+
cdef Py_ssize_t na_position
125125
cdef bint uses_mask
126126

127127
cpdef get_item(self, float64_t val)
@@ -131,7 +131,7 @@ cdef class Float64HashTable(HashTable):
131131

132132
cdef class Float32HashTable(HashTable):
133133
cdef kh_float32_t *table
134-
cdef int64_t na_position
134+
cdef Py_ssize_t na_position
135135
cdef bint uses_mask
136136

137137
cpdef get_item(self, float32_t val)
@@ -141,7 +141,7 @@ cdef class Float32HashTable(HashTable):
141141

142142
cdef class Complex64HashTable(HashTable):
143143
cdef kh_complex64_t *table
144-
cdef int64_t na_position
144+
cdef Py_ssize_t na_position
145145
cdef bint uses_mask
146146

147147
cpdef get_item(self, complex64_t val)
@@ -151,7 +151,7 @@ cdef class Complex64HashTable(HashTable):
151151

152152
cdef class Complex128HashTable(HashTable):
153153
cdef kh_complex128_t *table
154-
cdef int64_t na_position
154+
cdef Py_ssize_t na_position
155155
cdef bint uses_mask
156156

157157
cpdef get_item(self, complex128_t val)

pandas/_libs/hashtable_class_helper.pxi.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ cdef class {{name}}HashTable(HashTable):
535535
int ret = 0
536536
{{c_type}} val
537537
khiter_t k
538-
int8_t na_position = self.na_position
538+
Py_ssize_t na_position = self.na_position
539539

540540
if self.uses_mask and mask is None:
541541
raise NotImplementedError # pragma: no cover
@@ -567,7 +567,7 @@ cdef class {{name}}HashTable(HashTable):
567567
Int64Vector self_locs = Int64Vector()
568568
Int64VectorData *l
569569
Int64VectorData *sl
570-
int8_t na_position = self.na_position
570+
Py_ssize_t na_position = self.na_position
571571

572572
l = &locs.data
573573
sl = &self_locs.data
@@ -609,7 +609,7 @@ cdef class {{name}}HashTable(HashTable):
609609
{{c_type}} val
610610
khiter_t k
611611
intp_t[::1] locs = np.empty(n, dtype=np.intp)
612-
int8_t na_position = self.na_position
612+
Py_ssize_t na_position = self.na_position
613613

614614
if self.uses_mask and mask is None:
615615
raise NotImplementedError # pragma: no cover

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,8 @@ cdef class _Timedelta(timedelta):
17401740
Format the Timedelta as ISO 8601 Duration.
17411741

17421742
``P[n]Y[n]M[n]DT[n]H[n]M[n]S``, where the ``[n]`` s are replaced by the
1743-
values. See https://en.wikipedia.org/wiki/ISO_8601#Durations.
1743+
values. See Wikipedia:
1744+
`ISO 8601 § Durations <https://en.wikipedia.org/wiki/ISO_8601#Durations>`_.
17441745

17451746
Returns
17461747
-------

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ cdef class _Timestamp(ABCTimestamp):
13091309
By default, the fractional part is omitted if self.microsecond == 0
13101310
and self._nanosecond == 0.
13111311

1312-
If self.tzinfo is not None, the UTC offset is also attached, giving
1312+
If self.tzinfo is not None, the UTC offset is also attached,
13131313
giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmmnnn+HH:MM'.
13141314

13151315
Parameters

pandas/core/frame.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10286,7 +10286,9 @@ def apply(
1028610286
either the DataFrame's index (``axis=0``) or the DataFrame's columns
1028710287
(``axis=1``). By default (``result_type=None``), the final return type
1028810288
is inferred from the return type of the applied function. Otherwise,
10289-
it depends on the `result_type` argument.
10289+
it depends on the `result_type` argument. The return type of the applied
10290+
function is inferred based on the first computed result obtained after
10291+
applying the function to a Series object.
1029010292
1029110293
Parameters
1029210294
----------

pandas/core/reshape/concat.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,18 +477,23 @@ def _sanitize_mixed_ndim(
477477

478478
else:
479479
name = getattr(obj, "name", None)
480+
rename_columns = False
480481
if ignore_index or name is None:
481482
if axis == 1:
482483
# doing a row-wise concatenation so need everything
483484
# to line up
484-
name = 0
485+
if name is None:
486+
name = 0
487+
rename_columns = True
485488
else:
486489
# doing a column-wise concatenation so need series
487490
# to have unique names
488-
name = current_column
489-
current_column += 1
491+
if name is None:
492+
rename_columns = True
493+
name = current_column
494+
current_column += 1
490495
obj = sample._constructor(obj, copy=False)
491-
if isinstance(obj, ABCDataFrame):
496+
if isinstance(obj, ABCDataFrame) and rename_columns:
492497
obj.columns = range(name, name + 1, 1)
493498
else:
494499
obj = sample._constructor({name: obj}, copy=False)

pandas/io/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
_VALID_URLS = set(uses_relative + uses_netloc + uses_params)
7373
_VALID_URLS.discard("")
74-
_RFC_3986_PATTERN = re.compile(r"^[A-Za-z][A-Za-z0-9+\-+.]*://")
74+
_FSSPEC_URL_PATTERN = re.compile(r"^[A-Za-z][A-Za-z0-9+\-+.]*(::[A-Za-z0-9+\-+.]+)*://")
7575

7676
BaseBufferT = TypeVar("BaseBufferT", bound=BaseBuffer)
7777

@@ -291,7 +291,7 @@ def is_fsspec_url(url: FilePath | BaseBuffer) -> bool:
291291
"""
292292
return (
293293
isinstance(url, str)
294-
and bool(_RFC_3986_PATTERN.match(url))
294+
and bool(_FSSPEC_URL_PATTERN.match(url))
295295
and not url.startswith(("http://", "https://"))
296296
)
297297

0 commit comments

Comments
 (0)