I need to read data from a set of files in a folder. Certain fields are updated using the filename as a reference. This will be appended to a larger dataframe to export to an excel.
When I run this code without the "if" it gives the expected result. It only throws an error on encountering a folder. So I introduced the if to check if its a file. Now it throws no error but also give no output.
import pandas as pnd
import os
from os import listdir
from os.path import isfile, join
MyPath= "H:\Folder\Trial"
for CurrentFile in listdir(MyPath):
if os.path.isfile(CurrentFile):
.....Read some data.
I need to read data from the files in this folder. But right not it does nothing
Aucun commentaire:
Enregistrer un commentaire