I'm trying to write a function that will write pickle files from a list containing DataFrames. I want to iterate through that list and create a different pickle file, with a different file name, from each DataFrame. I've written this function:
def picklecreator(dflist):
a=1
for b in dflist:
b.to_pickle('filename_' + str(a) + '.pkl')
a=+1
return 1
This function only creates the first pickle file 'filename_1.pkl' How can I make it to work for all the DataFrames in my list?