Remove bad data i.e data that had some errors while scraping or feature generation
(self, features, historical_price_info, future_price_info, symbol_names)
| 241 | return features, historical_price_info, future_price_info, symbol_names |
| 242 | |
| 243 | def remove_bad_data(self, features, historical_price_info, future_price_info, symbol_names): |
| 244 | """ |
| 245 | Remove bad data i.e data that had some errors while scraping or feature generation |
| 246 | """ |
| 247 | length_dictionary = collections.Counter([len(feature) for feature in features]) |
| 248 | length_dictionary = list(length_dictionary.keys()) |
| 249 | most_common_length = length_dictionary[0] |
| 250 | |
| 251 | filtered_features, filtered_historical_price, filtered_future_prices, filtered_symbols = [], [], [], [] |
| 252 | for i in range(0, len(features)): |
| 253 | if len(features[i]) == most_common_length: |
| 254 | filtered_features.append(features[i]) |
| 255 | filtered_symbols.append(symbol_names[i]) |
| 256 | filtered_historical_price.append(historical_price_info[i]) |
| 257 | filtered_future_prices.append(future_price_info[i]) |
| 258 | |
| 259 | return filtered_features, filtered_historical_price, filtered_future_prices, filtered_symbols |
no outgoing calls
no test coverage detected