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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

從數(shù)據(jù)框中提取文本特征并將其與其他類型的特征(異構(gòu)數(shù)據(jù))一起用于 sklearn 目的:

從數(shù)據(jù)框中提取文本特征并將其與其他類型的特征(異構(gòu)數(shù)據(jù))一起用于 sklearn 目的:

慕斯王 2023-10-18 20:45:53
我試圖從類似于此的數(shù)據(jù)框中提取一些特征:feature1:float feature2:float feature3:string succeeded:boolean我遠(yuǎn)不是該主題的專家,但我嘗試了以下操作:from sklearn.feature_extraction.text import CountVectorizerimport scipy as spvectorizer = CountVectorizer()vectorizer.fit(small_df.feature3)X = sp.sparse.hstack( (vectorizer.transform(small_df.feature3),                 small_df[['feature1', 'feature2']),                 format='csr')X_columns = vectorizer.get_feature_names() + df[cols].columns.tolist()但是,我最終遇到以下錯(cuò)誤: TypeError: no supported conversion for types: (dtype('int64'), dtype('O'))任何幫助,將不勝感激!
查看完整描述

1 回答

?
撒科打諢

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊

解決方案:

X = sp.sparse.hstack( (vectorizer.transform(small_df.name),
                 small_df[cols].values.astype(np.float)))


查看完整回答
反對(duì) 回復(fù) 2023-10-18
  • 1 回答
  • 0 關(guān)注
  • 135 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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