Skip to content

Commit 91209d8

Browse files
authored
Merge pull request #156 from pandas-dev/master
Sync Fork from Upstream Repo
2 parents 785a0a0 + 029907c commit 91209d8

26 files changed

+512
-377
lines changed

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Deprecations
423423
- Using ``.astype`` to convert between ``datetime64[ns]`` dtype and :class:`DatetimeTZDtype` is deprecated and will raise in a future version, use ``obj.tz_localize`` or ``obj.dt.tz_localize`` instead (:issue:`38622`)
424424
- Deprecated casting ``datetime.date`` objects to ``datetime64`` when used as ``fill_value`` in :meth:`DataFrame.unstack`, :meth:`DataFrame.shift`, :meth:`Series.shift`, and :meth:`DataFrame.reindex`, pass ``pd.Timestamp(dateobj)`` instead (:issue:`39767`)
425425
- Deprecated :meth:`.Styler.set_na_rep` and :meth:`.Styler.set_precision` in favour of :meth:`.Styler.format` with ``na_rep`` and ``precision`` as existing and new input arguments respectively (:issue:`40134`, :issue:`40425`)
426-
- Deprecated allowing partial failure in :meth:`Series.transform` and :meth:`DataFrame.transform` when ``func`` is list-like or dict-like; will raise if any function fails on a column in a future version (:issue:`40211`)
426+
- Deprecated allowing partial failure in :meth:`Series.transform` and :meth:`DataFrame.transform` when ``func`` is list-like or dict-like and raises anything but ``TypeError``; ``func`` raising anything but a ``TypeError`` will raise in a future version (:issue:`40211`)
427427
- Deprecated support for ``np.ma.mrecords.MaskedRecords`` in the :class:`DataFrame` constructor, pass ``{name: data[name] for name in data.dtype.names}`` instead (:issue:`40363`)
428428
- Deprecated the use of ``**kwargs`` in :class:`.ExcelWriter`; use the keyword argument ``engine_kwargs`` instead (:issue:`40430`)
429429

pandas/_libs/algos.pyx

+12-9
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def nancorr_kendall(ndarray[float64_t, ndim=2] mat, Py_ssize_t minp=1) -> ndarra
490490
int64_t total_discordant = 0
491491
float64_t kendall_tau
492492
int64_t n_obs
493-
const int64_t[:] labels_n
493+
const intp_t[:] labels_n
494494

495495
N, K = (<object>mat).shape
496496

@@ -499,7 +499,7 @@ def nancorr_kendall(ndarray[float64_t, ndim=2] mat, Py_ssize_t minp=1) -> ndarra
499499

500500
ranked_mat = np.empty((N, K), dtype=np.float64)
501501
# For compatibility when calling rank_1d
502-
labels_n = np.zeros(N, dtype=np.int64)
502+
labels_n = np.zeros(N, dtype=np.intp)
503503

504504
for i in range(K):
505505
ranked_mat[:, i] = rank_1d(mat[:, i], labels_n)
@@ -591,16 +591,17 @@ def validate_limit(nobs: int, limit=None) -> int:
591591

592592
@cython.boundscheck(False)
593593
@cython.wraparound(False)
594-
def pad(ndarray[algos_t] old, ndarray[algos_t] new, limit=None):
594+
def pad(ndarray[algos_t] old, ndarray[algos_t] new, limit=None) -> ndarray:
595+
# -> ndarray[intp_t, ndim=1]
595596
cdef:
596597
Py_ssize_t i, j, nleft, nright
597-
ndarray[int64_t, ndim=1] indexer
598+
ndarray[intp_t, ndim=1] indexer
598599
algos_t cur, next_val
599600
int lim, fill_count = 0
600601

601602
nleft = len(old)
602603
nright = len(new)
603-
indexer = np.empty(nright, dtype=np.int64)
604+
indexer = np.empty(nright, dtype=np.intp)
604605
indexer[:] = -1
605606

606607
lim = validate_limit(nright, limit)
@@ -737,15 +738,16 @@ D
737738
@cython.boundscheck(False)
738739
@cython.wraparound(False)
739740
def backfill(ndarray[algos_t] old, ndarray[algos_t] new, limit=None) -> ndarray:
741+
# -> ndarray[intp_t, ndim=1]
740742
cdef:
741743
Py_ssize_t i, j, nleft, nright
742-
ndarray[int64_t, ndim=1] indexer
744+
ndarray[intp_t, ndim=1] indexer
743745
algos_t cur, prev
744746
int lim, fill_count = 0
745747

746748
nleft = len(old)
747749
nright = len(new)
748-
indexer = np.empty(nright, dtype=np.int64)
750+
indexer = np.empty(nright, dtype=np.intp)
749751
indexer[:] = -1
750752

751753
lim = validate_limit(nright, limit)
@@ -959,7 +961,7 @@ ctypedef fused rank_t:
959961
@cython.boundscheck(False)
960962
def rank_1d(
961963
ndarray[rank_t, ndim=1] values,
962-
const int64_t[:] labels,
964+
const intp_t[:] labels,
963965
ties_method="average",
964966
bint ascending=True,
965967
bint pct=False,
@@ -971,7 +973,8 @@ def rank_1d(
971973
Parameters
972974
----------
973975
values : array of rank_t values to be ranked
974-
labels : array containing unique label for each group, with its ordering
976+
labels : np.ndarray[np.intp]
977+
Array containing unique label for each group, with its ordering
975978
matching up to the corresponding record in `values`. If not called
976979
from a groupby operation, will be an array of 0's
977980
ties_method : {'average', 'min', 'max', 'first', 'dense'}, default

pandas/_libs/algos_take_helper.pxi.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ def take_2d_multi_{{name}}_{{dest}}(ndarray[{{c_type_in}}, ndim=2] values,
219219
fill_value=np.nan):
220220
cdef:
221221
Py_ssize_t i, j, k, n, idx
222-
ndarray[int64_t] idx0 = indexer[0]
223-
ndarray[int64_t] idx1 = indexer[1]
222+
ndarray[intp_t] idx0 = indexer[0]
223+
ndarray[intp_t] idx1 = indexer[1]
224224
{{c_type_out}} fv
225225

226226
n = len(idx0)

0 commit comments

Comments
 (0)