I have created a for loop which extracts all my files from my path and prints the same. I wanted to put this entire functions output into a dataframe and write it to a csv. I know we can do this in R by creating a vector but how do we do it in python?
import pandas
import glob
for filepath in glob.iglob('*.csv'):
fl = pandas.read_csv(filepath);
fl.insert(25,'city',filepath)
print(fl.groupby('city').mean())