Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Reference the row number in a function???

OMG!!! How do you return the row number in a DF???

For instance, all values in row one would be 1, all values in row two would be 2, all values in row 3 would be 3... without manually changing the values? You would think there would be a function like row() or row_number()

It is nowhere in the documentation!!!

ALSO!!! How exactly are you supposed to use data.current and data.history if they will only take a sid that is entered directly. They will not accept anything that comes from a dataFrame. So if you don't know exactly which stock you want to trade and you want to screen for them, then forget it.

Show me ONE example source code that actually orders a stock WITHOUT entering a single sid.

2 responses

I agree, the pandas.DataFrame API is unpleasantly complex and obscure. You want to learn about .ix and .loc. The documentation is worth a read too, but it's a bloody novel.

Ok, just found out that there is no information stored for the row such as it's position. That's not to say that you can't find the row position with a particular entry/value/index as with .iloc, .loc., .at, ect. The row is not an object itself. Anyways, this was a work around to another problem that has been solved by much simpler means. Thanks.