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
sample_train_df = train_df.loc[train_df.LCLid == "MAC000193", :]
sample_test_df = test_df.loc[test_df.LCLid == "MAC000193", :]
# display(sample_train_df)
train_features, train_target, train_original_target = feat_config.get_X_y(sample_train_df, categorical=False, exogenous=False
)
# Loading the Validation as test
test_features, test_target, test_original_target = feat_config.get_X_y(
sample_test_df, categorical=False, exogenous=False
)
del sample_train_df, sample_test_df
I continue to get this error message.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[14], line 5
2 sample_test_df = test_df.loc[test_df.LCLid == "MAC000193", :]
4 # display(sample_train_df)
----> 5 train_features, train_target, train_original_target = feat_config.get_X_y(sample_train_df, categorical=False, exogenous=False
6 )
7 # # Loading the Validation as test
8 # test_features, test_target, test_original_target = feat_config.get_X_y(
9 # sample_test_df, categorical=False, exogenous=False
10 # )
11 # del sample_train_df, sample_test_df
File ~\OneDrive - Florida A&M University\COURSES\Online\Modern-Time-Series-Forecasting-with-Python-main\src\forecasting\ml_forecasting.py:153, in FeatureConfig.get_X_y(self, df, categorical, exogenous)
150 feature_list = list(set(feature_list))
151 delete_index_cols = list(set(self.index_cols) - set(self.feature_list))
152 (X, y, y_orig) = (
--> 153 df.loc[:, set(feature_list + self.index_cols)]
154 .set_index(self.index_cols, drop=False)
155 .drop(columns=delete_index_cols),
156 df.loc[:, [self.target] + self.index_cols].set_index(
157 self.index_cols, drop=True
158 )
159 if self.target in df.columns
160 else None,
161 df.loc[:, [self.original_target] + self.index_cols].set_index(
162 self.index_cols, drop=True
163 )
164 if self.original_target in df.columns
165 else None,
166 )
167 return X, y, y_orig
File ~\anaconda3\envs\modern_ts\lib\site-packages\pandas\core\indexing.py:1091, in _LocationIndexer.__getitem__(self, key)
1089 @final
1090 def __getitem__(self, key):
-> 1091 check_dict_or_set_indexers(key)
1092 if type(key) is tuple:
1093 key = tuple(list(x) if is_iterator(x) else x for x in key)
File ~\anaconda3\envs\modern_ts\lib\site-packages\pandas\core\indexing.py:2618, in check_dict_or_set_indexers(key)
2610 """
2611 Check if the indexer is or contains a dict or set, which is no longer allowed.
2612 """
2613 if (
2614 isinstance(key, set)
2615 or isinstance(key, tuple)
2616 and any(isinstance(x, set) for x in key)
2617 ):
-> 2618 raise TypeError(
2619 "Passing a set as an indexer is not supported. Use a list instead."
2620 )
2622 if (
2623 isinstance(key, dict)
2624 or isinstance(key, tuple)
2625 and any(isinstance(x, dict) for x in key)
2626 ):
2627 raise TypeError(
2628 "Passing a dict as an indexer is not supported. Use a list instead."
2629 )
TypeError: Passing a set as an indexer is not supported. Use a list instead.
The text was updated successfully, but these errors were encountered:
May be a pandas version issue.. as an easy fix you can just wrap line #153 in ml_forecasting.py:153, in FeatureConfig.get_X_y(self, df, categorical, exogenous) with a list
I continue to get this error message.
The text was updated successfully, but these errors were encountered: