I create multiple dataframes by for loop and concat them, which works fine. But I need to include loop variable as index. I cant find a way to set loop variable as index
maindf=pd.DataFrame()
for i in ['20170724','20170725','20170726']:
a=pd.read_csv("somecsv."+str(i))
maindf = pd.concat(maindf,a,axis=0)
Expected OP for maindf:
A B C
20170724 1 2 3
4 5 6
7 8 9
20170725 11 22 33
44 55 66
77 88 99
20170725 111 222 333
444 555 666
777 888 999