Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

328
Views
from ..utils.fixes import rankdata ImportError: cannot import name 'rankdata' MongoDB

I am trying to run Skikit learn through Spyder on Anaconda

C:\Anaconda3>conda --version
conda 4.3.4
C:\Anaconda3>python --version
Python 3.5.2 :: Anaconda 4.0.0 (64-bit)
Spyder 2.3.8

I try to do the following:

print("Scikit-Learn", sklearn.__version__)
NameError: name 'sklearn' is not defined
from sklearn.model_selection import *
from ..utils.fixes import rankdata
ImportError: cannot import name 'rankdata'
Errors

Any idea why this error is coming as in Anaconda it shows the package as present but when I run through Spyder it gives the above error.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As you are using anaconda try:

conda update scikit-learn

Conda will try to handle de dependences and it may update other packages.

If this does not work, in the file fixes.py located in <Anaconda_basedir>\lib\python3.5\site-packages\sklearn\utils there is a line if sp_version < (0,13, 0): which conditions the import of rankdata if the version of scipy is lower than 0.13.0.

For som reason, if the version is > 0.13.0 it should use the rankdata from scipy.stats. But, at least in my case it wasn't, what I did was to add a and False so it gets the rankdata from scipy.

The final line is:

...
if sp_version < (0, 13, 0) and False:
    def rankdata(a, method='average'):
...
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!