Python - 尝试获取特定单词作为输出但收到错误
尝试将技能作为模式进行匹配并应用 groupby 函数,但接收为不可散列的列表。
Tec_skills=['MS SQL Server', 'Oracle','Machine Learning', 'Artificial Intelligence', 'Deep Neural Networks',
'Convolutional Neural Network', 'Sklearn Libraries', 'Keras','Tensor flow', 'SQL', 'C#','NoSQL',' Docker',
'Python','Shell','SQL/PLSQL','PLSQL','R','C','C++','AWS','Neural Networks,','CNN','RNN','Linear/Logistic Regression',
'Ensemble Trees, Gradient','Boosted trees, Bagging, Random forest','Time series','Data Visualization','Sentiment Analysis',
'Docker & Kubernetes','Classification','clustering','supervised','unsupervised']
def tech_skills(text):
word_tokens=word_tokenize(text)
filtered_stop_word = [word for word in word_tokens if word not in stopwords.words('english')]
all_combinations=' '.join,everygrams(filtered_stop_word,2,3)
#ext_skills=[]
ext_skills=re.findall(Tec_skills,all_combinations)
if ext_skills:
return (ext_skills.group(0))
return (ext_skills.group(0))
All_pdf_data_bygroup=All_pdf_data.groupby(All_pdf_data.index)
All_pdf_data_bygroup["text"].apply(lambda x: ' '.join(x)).apply(lambda x:tech_skills(x))
错误:类型错误:不可散列类型:“列表”
请建议如何解决该问题。
Trying to match the skills as a patter and apply a groupby function however receiving as unhashable list.
Tec_skills=['MS SQL Server', 'Oracle','Machine Learning', 'Artificial Intelligence', 'Deep Neural Networks',
'Convolutional Neural Network', 'Sklearn Libraries', 'Keras','Tensor flow', 'SQL', 'C#','NoSQL',' Docker',
'Python','Shell','SQL/PLSQL','PLSQL','R','C','C++','AWS','Neural Networks,','CNN','RNN','Linear/Logistic Regression',
'Ensemble Trees, Gradient','Boosted trees, Bagging, Random forest','Time series','Data Visualization','Sentiment Analysis',
'Docker & Kubernetes','Classification','clustering','supervised','unsupervised']
def tech_skills(text):
word_tokens=word_tokenize(text)
filtered_stop_word = [word for word in word_tokens if word not in stopwords.words('english')]
all_combinations=' '.join,everygrams(filtered_stop_word,2,3)
#ext_skills=[]
ext_skills=re.findall(Tec_skills,all_combinations)
if ext_skills:
return (ext_skills.group(0))
return (ext_skills.group(0))
All_pdf_data_bygroup=All_pdf_data.groupby(All_pdf_data.index)
All_pdf_data_bygroup["text"].apply(lambda x: ' '.join(x)).apply(lambda x:tech_skills(x))
ERROR:TypeError: unhashable type: 'list'
Please suggets how to resolve the issue .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论