Hi there
I'm tinkering in a notebook and want to print the values of my indicators (upper_band and lower_band) in a table along with current price and date.
The following works and prints 10 days of results, but is my horrible code!
Must be a far cleaner way and also one in which I could dynamically select the amount of day's results (n) to display in table.
Thanks in advance!
:-)
dates = pd.date_range('20150915',periods=10)
values = [
{'close':close[0] ,'lower_band': lower_band[0] ,'upper_band': upper_band[0]},
{'close':close[1] ,'lower_band': lower_band[1] ,'upper_band': upper_band[1]},
{'close':close[2] ,'lower_band': lower_band[2] ,'upper_band': upper_band[2]},
{'close':close[3] ,'lower_band': lower_band[3] ,'upper_band': upper_band[3]},
{'close':close[4] ,'lower_band': lower_band[4] ,'upper_band': upper_band[4]},
{'close':close[5] ,'lower_band': lower_band[5] ,'upper_band': upper_band[5]},
{'close':close[6] ,'lower_band': lower_band[6] ,'upper_band': upper_band[6]},
{'close':close[7] ,'lower_band': lower_band[7] ,'upper_band': upper_band[7]},
{'close':close[8] ,'lower_band': lower_band[8] ,'upper_band': upper_band[8]},
{'close':close[9] ,'lower_band': lower_band[9] ,'upper_band': upper_band[9]},
{'close':close[10] ,'lower_band': lower_band[10] ,'upper_band': upper_band[10]}
]
df = pd.DataFrame(values,dates)
df.head(10)