我的数据帧或浮点数中都没有空值。但是,错误仍然存在。
以下是有关我的数据的一些信息:
关于空值(据我所知,numpy.nan
s 在 pandas 中被编码为浮点数): 关于数据类型:
当我这样做时:
from tensorflow.keras.preprocessing.text import Tokenizer
title_tokeniser = Tokenizer(num_words=10)
title_tokeniser.fit_on_texts(train_set.loc[:,'title'] + test_set.loc[:,'title'])
这是错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-38-26b704f1c0a1> in <module>()
1 title_tokeniser = Tokenizer(num_words=10)
----> 2 title_tokeniser.fit_on_texts(train_set.loc[:,'title'] + test_set.loc[:,'title'])
3
4 # unique tokens found in titles are:
5 title_token_index = title_tokeniser.word_index
1 frames
/usr/local/lib/python3.6/dist-packages/keras_preprocessing/text.py in fit_on_texts(self, texts)
223 self.filters,
224 self.lower,
--> 225 self.split)
226 for w in seq:
227 if w in self.word_counts:
/usr/local/lib/python3.6/dist-packages/keras_preprocessing/text.py in text_to_word_sequence(text, filters, lower, split)
41 """
42 if lower:
---> 43 text = text.lower()
44
45 if sys.version_info < (3,):
AttributeError: 'float' object has no attribute 'lower'
红糖糍粑
相关分类