It's been a while since I have asked a questions but I am needing help with what I think is a simple task.
I have a list of string values which I have passed into a loop. Each one of the strings pertains to a function of a parent package (in this case, QuantStats).
Code appears as follows:
import QuantStats as qs
list = ['avg_loss', 'avg_gain', 'best']
for l in list:
(>>) print(l)
(>>) print(qs.stats.l(df['returns']) (Error here - 'l' not recognised. no output)
For some reason the qs.stats.l line does not work. I am not sure how to reference each element in the list, such that the qs function can run.
Hopefully there is a simple work around? Any thoughts would be very much appreciated :) thanks.