2

This is the code that I used to import my data as csv

from pandas import read_csv
from matplotlib import pyplot as pltplt
series = read_csv('final.csv', header=0, index_col=0)

this is the second one which I tried

import csv
with open('people.csv', 'r') as file:
    reader = csv.reader(file)
    for row in reader:
        print(row)

But I found same kind of error like this in both case

FileNotFoundError: [Errno 2] File final.csv does not exist: 'final.csv'
2
  • As the error says: FileNotFoundError: File final.csv does not exist. The code cannot find the file you've tried to open. Is the file in the same folder that you're launching the script from? Commented Nov 16, 2020 at 20:01
  • 1
    Does this answer your question? Pandas can't open a csv file FileNotFoundError Commented Nov 16, 2020 at 20:20

2 Answers 2

1

You could do following:

import pandas as pd
df = pd.read_csv("./Path/where/you/stored/table/data.csv")
print(df)

(df stands for data file)

File final.csv does not exist:

The error that you make is that you don't type in the correct path where the csv is stored. Are you using jupyter?

Sign up to request clarification or add additional context in comments.

1 Comment

thank you, this code really helped me to import my data set.
0

add the folder csv like with open('c:\\Users\\admin\\ ..... .csv', 'r') as file:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.