Python Forum
how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python (/thread-26627.html)

Pages: 1 2


how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - MohammedSohail - May-07-2020

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!


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - buran - May-07-2020

what do you think that single quote in front of backslash does? if you want to escape the backslash, use another backslash


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - MohammedSohail - May-07-2020

its not working Mr.Buran


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - buran - May-07-2020

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


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - MohammedSohail - May-07-2020

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


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - buran - May-07-2020

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


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - MohammedSohail - May-07-2020

It didn't work either. I dont know what's the problem. I tried all your ideas but it's not working


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - buran - May-07-2020

Dude, not working is not very helpfyl. How many time should ask you to post full traceback in error tags?


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - MohammedSohail - May-07-2020

That is the program I want to execute. I want to print all those columns in my csv file into python


RE: how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python - buran - May-07-2020

For the last time
post the full traceback that you get, in error tags. It can show what the problem is