Course Name: Introduction to Machine Learning for Trading, Section No: 7, Unit No: 6, Unit type: Notebook
I'd like to test the code with my own data file. I am using laptop running Win10. The file is stored in C:/Users/User/Desktop/. File name is aaa.csv. How to change the Python code in this unit to read the file?
Hi Hwang,
For Windows systems, you can use the following code to read the csv file and store it in a variable called df:
import pandas as pd
df = pd.read_csv("C:\Users\User\Desktop\aaa.csv")
The double backslashes are there since the first backslash is an escape character.
If the data file and the code file are in the same folder, then you can then use the following code:
import pandas as pd
df = pd.read_csv("aaa.csv")
Hope this helps!