第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 SciLearn Kit 讀取 Pandas 數(shù)據(jù)框時遇到問題

使用 SciLearn Kit 讀取 Pandas 數(shù)據(jù)框時遇到問題

慕妹3146593 2021-09-14 09:53:15
我是 Python 新手,在使用 Pandas 創(chuàng)建的數(shù)據(jù)幀上使用 SciLearn Kit 時遇到問題。下面是代碼:import numpy as npimport pandas as pdimport seaborn as snsimport matplotlib as pltimport json%matplotlib inlinedata = pd.read_json('C:/Users/Desktop/Machine Learning/yelp_academic_dataset_business.json', lines=True, orient='columns', encoding='utf-8')dataframe = pd.DataFrame(data)list(dataframe)subset_data = dataframe.loc[(dataframe.city == 'Toronto')]print(subset_data)documents = subset_data.to_dict('records')from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizerno_features = 1000# NMF is able to use tf-idftfidf_vectorizer = TfidfVectorizer(max_df=0.95, min_df=2, max_features=no_features, stop_words='english')tfidf = tfidf_vectorizer.fit_transform(documents)tfidf_feature_names = tfidf_vectorizer.get_feature_names()# LDA can only use raw term counts for LDA because it is a probabilistic graphical modeltf_vectorizer = CountVectorizer(max_df=0.95, min_df=2, max_features=no_features, stop_words='english')tf = tf_vectorizer.fit_transform(documents)tf_feature_names = tf_vectorizer.get_feature_names()下面是我得到的錯誤。AttributeError: 'dict' object has no attribute 'lower'數(shù)據(jù)集可在此處獲得:kaggle.com/yelp-dataset/yelp-dataset 數(shù)據(jù)集:yelp_academic_dataset_business.json任何幫助將不勝感激。謝謝你。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 360 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號