I have a DataFrame that I am iterating over to perform a function, like this:
for time, row in dataframe.loc[symbol].itertuples():
self.update(time, row.close)
I know that this is not the most efficient way, and that using apply() is faster.
However, as I need to access both time and row for my update() function, how would I be able to use apply() here?
I can create a function like this:
def update(time, row):
self.update(time, row.close)
But the part where I call apply(), not sure how to do:
dataframe.apply(update, axis=?) --> Need access to time (index) here too
Because I need both index (time) and row value for this.
All examples I've seen don't need the index.