from sklearn.impute import SimpleImputer
报错:
TypeError Traceback (most recent call last) Cell In[39], line 7 5 import seaborn as sns 6 # from sklearn.impute import SimpleImputer ----> 7 from sklearn.neighbors import StrOptions 8 import itertools File E:\Anaconda\Lib\site-packages\sklearn\neighbors\__init__.py:7 1 """ 2 The :mod:`sklearn.neighbors` module implements the k-nearest neighbors 3 algorithm. 4 """ 6 from ._ball_tree import BallTree ----> 7 from ._base import VALID_METRICS, VALID_METRICS_SPARSE, sort_graph_by_row_values 8 from ._classification import KNeighborsClassifier, RadiusNeighborsClassifier 9 from ._graph import ( 10 KNeighborsTransformer, 11 RadiusNeighborsTransformer, 12 kneighbors_graph, 13 radius_neighbors_graph, 14 ) File E:\Anaconda\Lib\site-packages\sklearn\neighbors\_base.py:378 374 else: 375 return neigh_ind --> 378 class NeighborsBase(MultiOutputMixin, BaseEstimator, metaclass=ABCMeta): 379 """Base class for nearest neighbors estimators.""" 381 _parameter_constraints: dict = { 382 "n_neighbors": [Interval(Integral, 1, None, closed="left"), None], 383 "radius": [Interval(Real, 0, None, closed="both"), None], (...) 389 "n_jobs": [Integral, None], 390 } File E:\Anaconda\Lib\site-packages\sklearn\neighbors\_base.py:387, in NeighborsBase() 378 class NeighborsBase(MultiOutputMixin, BaseEstimator, metaclass=ABCMeta): 379 """Base class for nearest neighbors estimators.""" 381 _parameter_constraints: dict = { 382 "n_neighbors": [Interval(Integral, 1, None, closed="left"), None], 383 "radius": [Interval(Real, 0, None, closed="both"), None], 384 "algorithm": [StrOptions({"auto", "ball_tree", "kd_tree", "brute"})], 385 "leaf_size": [Interval(Integral, 1, None, closed="left")], 386 "p": [Interval(Real, 0, None, closed="right"), None], --> 387 "metric": [StrOptions(set(itertools.chain(*VALID_METRICS.values()))), callable], 388 "metric_params": [dict, None], 389 "n_jobs": [Integral, None], 390 } 392 @abstractmethod 393 def __init__( 394 self, (...) 402 n_jobs=None, 403 ): 404 self.n_neighbors = n_neighbors TypeError: 'builtin_function_or_method' object is not iterable