Folder path error

I’m trying to add folder path where it is saved in my PC but getting error each time as below, Ho can fix it?

write your code here

import matplotlib.pyplot as plt
import pandas as pd
import pylab as pl
import numpy as np
%matplotlib inline

df = np.read_csv(“D:/Khuram/Data.csv”)


ileNotFoundError Traceback (most recent call last)
5 import numpy as np
6 get_ipython().run_line_magic(‘matplotlib’, ‘inline’)
----> 7 my_file_handle= open(“D:/Khuram/Data.csv”)
8 df = np.read_csv(“D:/Khuram/Data.csv”)

FileNotFoundError: [Errno 2] No such file or directory: ‘D:/Khuram/Data.csv’

I note that you are on Windows from the type of path you have typed. Are you using OneDrive at all?
That has really caused in issue of Windows users not actually knowing where the files are located. See the very end of this post, the links there, and the reply by daSandvich for some guidance.

You may want to read this post about how to explore your file system from within the notebook to convince yourself that the path you have pointed np.read_csv() is or is not the case. And maybe find the file and fix your path.

For future posts on this forum, you’ll want to take advantage of how to post code so others can run it. Luckily, your code in this case didn’t have an indenting that would get lost by just pasting, as you did. You should use markdown to signal a code block as you are composing your posts. See the ‘Block code formatting’ section here for how to do that. That works great for small blocks, like what you posted.
If your need to post a lot of code or a log of something, it is better to use a gist ( or other snippet sharing sites such as pastebin, see 10 Best Pastebin Alternatives.

1 Like