May-01-2017, 11:44 AM
I'm trying to loop through a list(y) and output by appending a row for each item to a dataframe.
Desired Output:
Index         Mean       Last
2017-03-29 Â Â Â 1.5 Â Â Â Â Â Â Â Â .76
y=[datetime.datetime(2017, 3, 29), datetime.datetime(2017, 3, 30), datetime.datetime(2017, 3, 31)]
Desired Output:
Output:Index         Mean       Last
2017-03-29 Â Â Â Â 1.5 Â Â Â Â Â Â Â .76
2017-03-30 Â Â Â Â 2.3 Â Â Â Â Â Â Â .4
2017-03-31Â Â Â Â 1.2 Â Â Â Â Â Â Â 1Â
Here is the first and last part of the code I currently have:df5=pd.DataFrame(columns=['Mean','Last'],index=index) for item0 in y: ......... .........   df=df.rename(columns = {0:'Mean'})   df4=pd.concat([df, df3], axis=1)   print (df4)   df5.append(df4)   print (df5)My code only puts one row into the dataframe like as opposed to a row for each item in y:
Index         Mean       Last
2017-03-29 Â Â Â 1.5 Â Â Â Â Â Â Â Â .76