I am trying to write a for loop to create multiple dataframes based on dates. this is the basic code:
gl2 is a list of dataframe names
dts and dte are pandas timestamps
gl2=['aaj', 'cbd', 'cbu','fms','nyp']
for i in gl2:
mask=(i['datetime']>=dts) & (i['datetime']<=dte)
dfname=str(i+'e')
dfname=i.loc[mask]
this returns a TypeError : string indices must be integers
mask=(aaj['datetime'] >= dts) & (aaj['datetime']<=dte)
aaje=aaj.loc[mask]
returns the desired dataframe, but i may need to create many such dataframes and want to automate the process