【发布时间】:2021-04-20 13:24:36
【问题描述】:
我是 VSCode 的新手,我一直在尝试从 Jupyter 切换过来,并且非常挣扎。我现在的主要项目是开发一个工作情绪分析程序,我什至无法开始,因为我无法读取我的数据。
这是我当前的代码:
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
data_train = pd.read_csv("trainingData/yelp_review_full_csv/train.csv", header = None)
data_test = pd.read_csv("trainingData/yelp_review_full_csv/test.csv", header = None)
data_train.head(5)
我的 launch.json 是
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"python": "${command:python.interpreterPath}",
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}"
}
]
}
我搜索了所有可能的方法,每次遇到同样的错误。有人可以建议如何解决此问题吗?
【问题讨论】:
-
写入文件的完整路径。或者将训练数据文件放在您正在处理的同一目录中。
标签: python pandas visual-studio-code