Saturday, January 21, 2017

List all files of a directory in Python

from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(pf2_path) if isfile(join(pf2_path, f))]

for f in onlyfiles:
    pf = pd.read_csv(pf2_path+f)
    print("%s %s" % (f, pf.shape))

No comments:

Post a Comment