我是webscraping,我將utf-8保存到csv,清理它,現在我正在嘗試創建我的培訓和測試文件,以便能夠使用Facebook快速文本,現在是我和它給我一個錯誤fastText python實現創建培訓和測試集
from sklearn.cross_validation import train_test_split
y_all = df["normalized"]
X_all = df.drop('normalized', axis = 1)
X_train, X_test, y_train, y_test = train_test_split(X_all, y_all, `test_size=0.3, random_state=1)`
import fasttext as ft
classifier = ft.supervised(X_train, y_train)
,這是它返回的錯誤,這是fastText在jupyter筆記本窗戶
TypeError Traceback (most recent call last)
<ipython-input-47-1f4fa41d367f> in <module>()
----> 1 classifier = ft.supervised(X_train, y_train)
fasttext/fasttext.pyx in fasttext.fasttext.supervised (fasttext/fasttext.cpp:6665)()
fasttext/fasttext.pyx in fasttext.fasttext.train_wrapper (fasttext/fasttext.cpp:4732)()
C:\Program Files\Anaconda3\lib\genericpath.py in isfile(path)
28 """Test whether a path is a regular file"""
29 try:
---> 30 st = os.stat(path)
31 except OSError:
32 return False
TypeError: argument should be string, bytes or integer, not DataFrame
試着做'y_all = df [「normalized」]。values' 'X_all = df.drop('normalized',axis = 1).values' –