Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ValueError Traceback (most recent call last)
- <ipython-input-27-7085cf325d4c> in <module>
- 1 arr = ['foo', 'bar']
- 2 data = pd.Series(data=arr)
- ----> 3 CountVectorizer(data).fit(data)
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit(self, raw_documents, y)
- 1022 self
- 1023 """
- -> 1024 self.fit_transform(raw_documents)
- 1025 return self
- 1026
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in fit_transform(self, raw_documents, y)
- 1056
- 1057 vocabulary, X = self._count_vocab(raw_documents,
- -> 1058 self.fixed_vocabulary_)
- 1059
- 1060 if self.binary:
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in _count_vocab(self, raw_documents, fixed_vocab)
- 968 for doc in raw_documents:
- 969 feature_counter = {}
- --> 970 for feature in analyze(doc):
- 971 try:
- 972 feature_idx = vocabulary[feature]
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in <lambda>(doc)
- 350 tokenize)
- 351 return lambda doc: self._word_ngrams(
- --> 352 tokenize(preprocess(self.decode(doc))), stop_words)
- 353
- 354 else:
- ~/.conda/envs/ds36/lib/python3.6/site-packages/sklearn/feature_extraction/text.py in decode(self, doc)
- 130 The string to decode
- 131 """
- --> 132 if self.input == 'filename':
- 133 with open(doc, 'rb') as fh:
- 134 doc = fh.read()
- ~/.conda/envs/ds36/lib/python3.6/site-packages/pandas/core/generic.py in __nonzero__(self)
- 1553 "The truth value of a {0} is ambiguous. "
- 1554 "Use a.empty, a.bool(), a.item(), a.any() or a.all().".format(
- -> 1555 self.__class__.__name__
- 1556 )
- 1557 )
- 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