Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. TypeError Traceback (most recent call last)
  2. <ipython-input-44-a553646a889c> in <module>
  3. 22 for i, samples in enumerate([samples_1, samples_10, samples_100]):
  4. 23 results[clf_name][i] = \
  5. ---> 24 train_predict(clf, samples, X_train, y_train, X_test, y_test)
  6. 25
  7. 26 # Run metrics visualization for the three supervised learning models chosen
  8.  
  9. <ipython-input-36-2fd67492e721> in train_predict(learner, sample_size, X_train, y_train, X_test, y_test)
  10. 19 # TODO: Fit the learner to the training data using slicing with ‘sample_size’ using .fit(training_features[:], training_labels[:])
  11. 20 start = time() # Get start time
  12. ---> 21 learner.fit(X_train[:sample_size],y_train[:sample_size])
  13. 22 end = time() # Get end time
  14. 23
  15.  
  16. /anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
  17. 2674
  18. 2675 # see if we can slice the rows
  19. -> 2676 indexer = convert_to_index_sliceable(self, key)
  20. 2677 if indexer is not None:
  21. 2678 return self._getitem_slice(indexer)
  22.  
  23. /anaconda3/lib/python3.7/site-packages/pandas/core/indexing.py in convert_to_index_sliceable(obj, key)
  24. 2324 idx = obj.index
  25. 2325 if isinstance(key, slice):
  26. -> 2326 return idx._convert_slice_indexer(key, kind=‘getitem’)
  27. 2327
  28. 2328 elif isinstance(key, compat.string_types):
  29.  
  30. /anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in _convert_slice_indexer(self, key, kind)
  31. 1725 if self.is_integer() or is_index_slice:
  32. 1726 return slice(self._validate_indexer(‘slice’, key.start, kind),
  33. -> 1727 self._validate_indexer(‘slice’, key.stop, kind),
  34. 1728 self._validate_indexer(‘slice’, key.step, kind))
  35. 1729
  36.  
  37. /anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in _validate_indexer(self, form, key, kind)
  38. 4143 pass
  39. 4144 elif kind in [‘iloc’, ‘getitem’]:
  40. -> 4145 self._invalid_indexer(form, key)
  41. 4146 return key
  42. 4147
  43.  
  44. /anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in _invalid_indexer(self, form, key)
  45. 1861 “indexers [{key}] of {kind}“.format(
  46. 1862 form=form, klass=type(self), key=key,
  47. -> 1863 kind=type(key)))
  48. 1864
  49. 1865 def get_duplicates(self):
  50.  
  51. TypeError: cannot do slice indexing on <class ‘pandas.core.indexes.numeric.Int64Index’> with these indexers [361.77] of <class ‘float’>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement