Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.19 KB | None | 0 0
  1. ValueError                                Traceback (most recent call last)
  2. <ipython-input-27-7085cf325d4c> in <module>
  3.       1 arr = ['foo', 'bar']
  4.       2 data = pd.Series(data=arr)
  5. ----> 3 CountVectorizer(data).fit(data)
  6.  
  7. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit(self, raw_documents, y)
  8.    1022         self
  9.    1023         """
  10. -> 1024         self.fit_transform(raw_documents)
  11.   1025         return self
  12.   1026
  13.  
  14. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit_transform(self, raw_documents, y)
  15.   1056
  16.   1057         vocabulary, X = self._count_vocab(raw_documents,
  17. -> 1058                                           self.fixed_vocabulary_)
  18.   1059
  19.   1060         if self.binary:
  20.  
  21. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in _count_vocab(self, raw_documents, fixed_vocab)
  22.    968         for doc in raw_documents:
  23.    969             feature_counter = {}
  24. --> 970             for feature in analyze(doc):
  25.    971                 try:
  26.    972                     feature_idx = vocabulary[feature]
  27.  
  28. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in <lambda>(doc)
  29.    350                                                tokenize)
  30.    351             return lambda doc: self._word_ngrams(
  31. --> 352                 tokenize(preprocess(self.decode(doc))), stop_words)
  32.    353
  33.    354         else:
  34.  
  35. ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in decode(self, doc)
  36.    130             The string to decode
  37.    131         """
  38. --> 132         if self.input == 'filename':
  39.     133             with open(doc, 'rb') as fh:
  40.     134                 doc = fh.read()
  41.  
  42. ~/.conda/envs/ds36/lib/python3.6/site-packages/pandas/core/generic.py in __nonzero__(self)
  43.    1553             "The truth value of a {0} is ambiguous. "
  44.    1554             "Use a.empty, a.bool(), a.item(), a.any() or a.all().".format(
  45. -> 1555                 self.__class__.__name__
  46.    1556             )
  47.    1557         )
  48.  
  49. ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement