Error while reading csv file using Pandas

pandas

#1

Trying on Win 7 , python 3 – reading csv file placed in my system … used 3 diff ways but face error in all three.

df=pd.read_csv(r"C:\Users\xxx_ADMIN\Desktop\Data_Science\DataSet\cdc_prediction\test.csv")
df=pd.read_csv(“C:/Users/xxx_ADMIN/Desktop/Data_Science/DataSet/cdc_prediction/test.csv”)
df=pd.read_csv(“C:\Users\xxx_ADMIN\Desktop\Data_Science\DataSet\cdc_prediction\test.csv”)

pandas/parser.pyx in pandas.parser.TextReader.cinit (pandas/parser.c:3427)()

pandas/parser.pyx in pandas.parser.TextReader._setup_parser_source (pandas/parser.c:6861)()

OSError: File b’C:\Users\xxx_ADMIN\Desktop\Data_Science\DataSet\cdc_prediction\test.csv’ does not exist


#2

Hi,

Copy the location of the file from the properties section to avoid any errors and use the following format to read a CSV file.

df = pd.read_csv(r"location\file_name.csv")


#3

Hi @yashu8888,

try this code(with forward slash):

import pandas as pd

df = pd.read_csv((“C:/Users/xxx_ADMIN/Desktop/Data_Science/DataSet/cdc_prediction/test.csv”)

Note: Your location path should not have any Space!