![]() ![]() I had to modify the table string to be able to convert it into a Pandas dataframe. ![]() Output of features: array(),Īrray(),Īrray()], Can someone please point out what can be wrong here. I have checked all the size of subarray and everything's same and also data type. ValueError: setting an array element with a sequence. > 746 array = np.asarray(array, order=order, dtype=dtype)ħ47 except ComplexWarning as complex_warning: ~/miniconda3/envs/dev_env_37/lib/python3.7/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)ħ44 array = array.astype(dtype, casting="unsafe", copy=False) > 566 X = check_array(X, **check_params) ~/miniconda3/envs/dev_env_37/lib/python3.7/site-packages/sklearn/base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)ĥ64 raise ValueError("Validation should be done on X, y or both.") > 435 X = self._validate_data(X, accept_sparse="csr") ~/miniconda3/envs/dev_env_37/lib/python3.7/site-packages/sklearn/neighbors/_base.py in _fit(self, X, y)Ĥ34 if not isinstance(X, (KDTree, BallTree, NeighborsBase)): ![]() ~/miniconda3/envs/dev_env_37/lib/python3.7/site-packages/sklearn/neighbors/_unsupervised.py in fit(self, X, y)ġ64 The fitted nearest neighbors estimator. > 1 knnobj = NearestNeighbors(n_neighbors=5, algorithm='auto').fit(features) ValueError Traceback (most recent call last) The above exception was the direct cause of the following exception: TypeError: only size-1 arrays can be converted to Python scalars Now here I'm getting error: TypeError Traceback (most recent call last) ![]() Knnobj = NearestNeighbors(n_neighbors=5, algorithm='auto').fit(features) Now I have to find nearest neighbor for this features so here are my step: df_collect = df.toPandas()ĭf_collect = df_collect.apply(lambda x: np.array(x))įeatures = df_collect.to_numpy() I have pyspark dataframe like this: +-+-+ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |