Aug-23-2023, 11:11 AM
This is how you can create a dataframe from the file list. (change '/your/path' to your path)
import pandas as pd import os full_path = '/your/path' # create list from files in folder file_list = os.listdir(full_path) data = [] for file in sorted(os.listdir(full_path)): data.append((f"{full_path}/{file}", file)) df = pd.DataFrame(data, columns=['Full Path', 'File Name']) print (df) print(35*"#") for index, row in df.iterrows(): name = df['File Name'].iloc[[index]].values[0] fullpath = df['Full Path'].iloc[[index]].values[0] print(f"Name: {name}\nPath: {fullpath}")