Python Forum

Full Version: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am not able to run my code. This is my code
##############
import pandas as pd

df = pd.read_csv("C:'\Users'\User'\Downloads'\weathercsv")
print("The size of the data frame is: ", df.shape)
##############

The error says no such file or directory found. I have checked my data in files it's in the same location
but when i copy paste that location into python, pycharm and run it it says the following error. It's not found.

Please someone help!
what do you think that single quote in front of backslash does? if you want to escape the backslash, use another backslash
its not working Mr.Buran
df = pd.read_csv("C:\\Users\\User\\Downloads\\weather.csv")
or
df = pd.read_csv(r"C:\Users\User\Downloads\weather.csv")
also Please, always post the entire traceback that you get. We need to see that whole thing. Do not just give us the last line.
Take a time to read What to include in a post

EDIT: I fixed the second one - it was meant to be raw string
I have tried that solution but its not working. I am just struck here it says no file or directory found and it says unicode error
sorry, the second one should be a raw string

df = pd.read_csv(r"C:\Users\User\Downloads\weather.csv")
but first one would work anyway
It didn't work either. I dont know what's the problem. I tried all your ideas but it's not working
Dude, not working is not very helpfyl. How many time should ask you to post full traceback in error tags?
That is the program I want to execute. I want to print all those columns in my csv file into python
For the last time
post the full traceback that you get, in error tags. It can show what the problem is
Pages: 1 2