I'm new to VSCode and have been trying to switch over from Jupyter and am severely struggling. My main project right now is developing a sentiment analysis program for work and I can't even start because I can't read my data in.
This is my current code:
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)
My launch.json is
{
// 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}"
}
]
}
I have googled every method possible and every time I get the same error. Can someone please advise on how to fix this issue?
1.When the read file(.py file) and the data file(.csv file) are in the same folder:
1>. When use: "cwd": "${workspaceFolder}",
(default value of cwd) in launch.json.
2>. When use "cwd": "${fileDirname}"
2.When the read file and data file are in different folders: please use "cwd": "${workspaceFolder}",
Reference: cwd in VS Code .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.