I'm trying to read multiple csv files in a directory, using pandas. I used two methods, and both are not working.
import os
from glob import glob
from math import*
from numpy import*
from pandas import*
path = '/Volumes/File/Names/Stuff 2016'
for filename in glob(os.path.join(path, '*.csv')):
qu = read_csv(filename, delimiter = ';', header = 0, skiprows = 24, nrows=2)
print(qu)
Edit:(The above code works.)
Below when I try to just read all files in that specific path, without specifying it's a csv:
for filename in os.listdir(path):
q = read_csv(filename, delimiter = ';', header = 0, skiprows = 24, nrows=2)
FileNotFoundError: File b'STD_20160103.00.csv' does not exist
This error is confusing me, since that specific file does exist in the directory. I'm wondering if the file names '*.00.csv' are the problem, but I just want to print the values along all the files, and it's not working. Thanks
print(filename)statement in just before theread_csvand you will see what's wrong.