简体   繁体   中英

Error in importing module of python library scipy

I am working on clustering in python. The package I want to import is

from scipy.spatial.distance import dist

but this is showing the following error.

ImportError: cannot import name 'dist' from 'scipy.spatial.distance' (C:\Users\majid\Anaconda3\lib\site-packages\scipy\spatial\distance.py)

Instead of importing dist you need to import pdist or cdist based on your requirement as per the SciPy documentation:

pdist(X[, metric])

Pairwise distances between observations in n-dimensional space.

cdist(XA, XB[, metric])

Compute distance between each pair of the two collections of inputs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM