my folder organization looks like below. Type 1 and Type 2 folders contains same files but I want to only read the files from 'type 2' folder. Is there any simple way to do that?
I have used this code but not able to read:
for file in os.listdir('Type 2'):
print file

your help will be highly appreciated!
IIUC you need read_csv in folders Type 2, use glob:
files = glob.glob('main/**/Type 2/*.csv')
dfs = [pd.read_csv(fp) for fp in files]
df = pd.concat(dfs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With