- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 19.2k
 
Closed
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffBugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version
Milestone
Description
- 
[yes] I have checked that this issue has not already been reported.
 - 
[yes] I have confirmed this bug exists on the latest version of pandas.
 
Code Sample, a copy-pastable example
# this works:
pandas.Series(numpy.random.random(10)).nlargest(5)
# this works on pandas 1.2.5 but fails on 1.3.0 and 1.3.1.  All Float64DType Series seem to have the same issue
pandas.Series(numpy.random.random(10)).astype('Float64').nlargest(5)Software/hardware
python version: 3.8.10
Ubuntu 20.04
(Intel Tiger Lake CPU)
Stack trace
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_213893/2592114079.py in <module>
----> 1 pandas.Series(numpy.random.random(10)).astype('Float64').nlargest(5)
~/.pyenv/versions/3.8.10/envs/myvenv/lib/python3.8/site-packages/pandas/core/series.py in nlargest(self, n, keep)
   3764         dtype: int64
   3765         """
-> 3766         return algorithms.SelectNSeries(self, n=n, keep=keep).nlargest()
   3767 
   3768     def nsmallest(self, n: int = 5, keep: str = "first") -> Series:
~/.pyenv/versions/3.8.10/envs/myvenv/lib/python3.8/site-packages/pandas/core/algorithms.py in nlargest(self)
   1217 
   1218     def nlargest(self):
-> 1219         return self.compute("nlargest")
   1220 
   1221     def nsmallest(self):
~/.pyenv/versions/3.8.10/envs/myvenv/lib/python3.8/site-packages/pandas/core/algorithms.py in compute(self, method)
   1285         # arr passed into kth_smallest must be contiguous. We copy
   1286         # here because kth_smallest will modify its input
-> 1287         kth_val = algos.kth_smallest(arr.copy(order="C"), n - 1)
   1288         (ns,) = np.nonzero(arr <= kth_val)
   1289         inds = ns[arr[ns].argsort(kind="mergesort")]
~/.pyenv/versions/3.8.10/envs/myvenv/lib/python3.8/site-packages/pandas/_libs/algos.pyx in pandas._libs.algos.__pyx_fused_cpdef()
TypeError: No matching signature found
Thanks!
Metadata
Metadata
Assignees
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffBugNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas version