I have a small follow-up for you if you are still there. If I use youtt function interactively I am fine, but If I include it as part of script, it trips an error because python thinks 'df' is a string:
ipython-input-487-b0961288d5e6> in iternamedtuples(df)
1 def iternamedtuples(df=DataFrame()):
----> 2 Row = namedtuple('Row', df.columns)
3 for row in df.itertuples():
4 yield Row(*row[1:])
AttributeError: 'str' object has no attribute 'columns'
Can you declare a variable in a function as a pandas object?
thanks
zach cp