我正在网页抓取,我将我的 utf-8 保存到 csv,清理它,现在我正在尝试创建我的训练和测试文件以便能够使用 Facebook 的 fastText,现在这就是我所拥有的,它给了我一个错误
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)
这是它返回的错误,这是 jupyter notebook 中 windows 的 fastText
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