Python Forum
how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python
#1
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!
Reply
#2
what do you think that single quote in front of backslash does? if you want to escape the backslash, use another backslash
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
its not working Mr.Buran
Reply
#4
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
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
Reply
#6
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
It didn't work either. I dont know what's the problem. I tried all your ideas but it's not working
Reply
#8
Dude, not working is not very helpfyl. How many time should ask you to post full traceback in error tags?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
That is the program I want to execute. I want to print all those columns in my csv file into python
Reply
#10
For the last time
post the full traceback that you get, in error tags. It can show what the problem is
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with opening csv file in pandas saratha 2 527 Jul-21-2020, 10:55 AM
Last Post: saratha
  Can't read text file with pandas zinho 6 3,806 May-24-2020, 06:13 AM
Last Post: azajali43
  loading a csv file into python from pandas. Variable is not recognized vijjumodi 2 985 Apr-19-2019, 04:09 AM
Last Post: kus
  read complex file with both pandas and not Diedro 1 964 Jan-29-2019, 05:26 PM
Last Post: Larz60+
  Load .abf file and for analysis with Pandas finalcode 0 1,085 Nov-10-2018, 09:51 AM
Last Post: finalcode
  Solve a system of non-linear equations in Python (scipy.optimize.fsolve) drudox 7 15,330 Aug-18-2018, 02:27 AM
Last Post: scidam
  Python Directory Error - Please help shaanali 2 1,344 Jun-12-2018, 06:50 PM
Last Post: shaanali

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020