You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/TMOF_ML/feature_selector.py:211, in FeatureSelector.identify_collinear(self, correlation_threshold, one_hot)
207 # Iterate through the columns to drop to record pairs of correlated features
208 for column in to_drop:
209
210 # Find the correlated features
--> 211 corr_features = list(upper.index[upper[column].abs() > correlation_threshold])
213 # Find the correlated values
214 corr_values = list(upper[column][upper[column].abs() > correlation_threshold])
File ~/.conda/envs/ML/lib/python3.8/site-packages/pandas/core/indexes/base.py:5196, in Index.getitem(self, key)
5193 else:
5194 key = np.asarray(key, dtype=bool)
-> 5196 result = getitem(key)
5197 # Because we ruled out integer above, we always get an arraylike here
5198 if result.ndim > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
The text was updated successfully, but these errors were encountered:
too many indices for array: array is 1-dimensional, but 2 were indexed
How can I solve this problems?
When I am using this code
it turns out to be:
IndexError Traceback (most recent call last)
Cell In[107], line 1
----> 1 fs.identify_collinear(correlation_threshold=0.8)
2 correlated_features = fs.ops['collinear']
3 correlated_features
File ~/TMOF_ML/feature_selector.py:211, in FeatureSelector.identify_collinear(self, correlation_threshold, one_hot)
207 # Iterate through the columns to drop to record pairs of correlated features
208 for column in to_drop:
209
210 # Find the correlated features
--> 211 corr_features = list(upper.index[upper[column].abs() > correlation_threshold])
213 # Find the correlated values
214 corr_values = list(upper[column][upper[column].abs() > correlation_threshold])
File ~/.conda/envs/ML/lib/python3.8/site-packages/pandas/core/indexes/base.py:5196, in Index.getitem(self, key)
5193 else:
5194 key = np.asarray(key, dtype=bool)
-> 5196 result = getitem(key)
5197 # Because we ruled out integer above, we always get an arraylike here
5198 if result.ndim > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
The text was updated successfully, but these errors were encountered: