Apr-27-2017, 06:43 PM
(This post was last modified: Apr-27-2017, 06:53 PM by nocoffeenoworkee.)
I'm trying to loop through a list(y) and output by appending a row for each item in y to a dataframe.
y=[datetime.datetime(2017, 3, 29), datetime.datetime(2017, 3, 30), datetime.datetime(2017, 3, 31)]
y=[datetime.datetime(2017, 3, 29), datetime.datetime(2017, 3, 30), datetime.datetime(2017, 3, 31)]
Output:Index Mean Last
2017-03-29 1.5 .76
2017-03-30 2.3 1
2017-03-31 1.2 .4
Here is the first and last part of the code I 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) df5.append(df4) print (df5)It only puts one row into the dataframe like:
Output:Index Mean Last
2017-03-29 1.5 .76