我想要用jieba对content一列进行分词:
结果总是出现“AttributeError: 'float' object has no attribute 'decode',为了解决这个问题,把这个series变成str之后又无法loop,请问我应该怎么处理呢?谢谢!
camsedfj1#
我如果猜测没错,你想写的代码应该是
t_list = [] t_list += list(jieba.cut(sample['content']))
如果不是你应该把你具体哪句出错列出来,不过很可能是python 语法不熟造成的
yks3o0rb2#
您好,谢谢您的热心回答!第一次在github发问题不是很清楚问法,给您造成麻烦啦~ 问题我已经解决啦,是我数据本身的问题,让我加入一个conditional loop就OK啦~谢谢您! 祝好~ 2018-04-19 15:47 GMT+08:00 MoreFreeze notifications@github.com:…
我如果猜测没错,你想写的代码应该是 t_list = [] t_list += list(jieba.cut(sample['content'])) 如果不是你应该把你具体哪句出错列出来,不过很可能是python 语法不熟造成的 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#617 (comment)>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AhgNuVNwsxwnvtduCq8KfQGDIgnVnRlhks5tqEEhgaJpZM4TPapa > .
cu6pst1q3#
您好,谢谢您的热心回答!第一次在github发问题不是很清楚问法,给您造成麻烦啦~
问题我已经解决啦,是我数据本身的问题,让我加入一个conditional loop就OK啦~谢谢您!
祝好~
2018-04-19 15:47 GMT+08:00 MoreFreeze notifications@github.com :…
你好,请问你是怎么解决的呀 我也出现了类似的问题
p4rjhz4m4#
The errors occurs if you have NaN in your cell and if you are using pandas.It should be better to skip NaN Values
s = float("nan") jieba.cut(s, cut_all=False)
brccelvz5#
Can you be more specific on how to use your idea, Can't understand. Thank you in advance .Let's say we have
df= pd.read_sql('SELECT * FROM wechat_article_comment', con=db_connection)words = list(jieba.cut(df['content']))
Then error message,AttributeError: 'Series' object has no attribute 'decode'
5条答案
按热度按时间camsedfj1#
我如果猜测没错,你想写的代码应该是
如果不是你应该把你具体哪句出错列出来,不过很可能是python 语法不熟造成的
yks3o0rb2#
您好,谢谢您的热心回答!第一次在github发问题不是很清楚问法,给您造成麻烦啦~ 问题我已经解决啦,是我数据本身的问题,让我加入一个conditional loop就OK啦~谢谢您! 祝好~ 2018-04-19 15:47 GMT+08:00 MoreFreeze notifications@github.com:…
我如果猜测没错,你想写的代码应该是 t_list = [] t_list += list(jieba.cut(sample['content'])) 如果不是你应该把你具体哪句出错列出来,不过很可能是python 语法不熟造成的 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#617 (comment)>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AhgNuVNwsxwnvtduCq8KfQGDIgnVnRlhks5tqEEhgaJpZM4TPapa > .
cu6pst1q3#
您好,谢谢您的热心回答!第一次在github发问题不是很清楚问法,给您造成麻烦啦~
问题我已经解决啦,是我数据本身的问题,让我加入一个conditional loop就OK啦~谢谢您!
祝好~
2018-04-19 15:47 GMT+08:00 MoreFreeze notifications@github.com :
…
你好,请问你是怎么解决的呀 我也出现了类似的问题
p4rjhz4m4#
The errors occurs if you have NaN in your cell and if you are using pandas.
It should be better to skip NaN Values
brccelvz5#
The errors occurs if you have NaN in your cell and if you are using pandas.
It should be better to skip NaN Values
Can you be more specific on how to use your idea, Can't understand. Thank you in advance .
Let's say we have
df= pd.read_sql('SELECT * FROM wechat_article_comment', con=db_connection)
words = list(jieba.cut(df['content']))
Then error message,
AttributeError: 'Series' object has no attribute 'decode'