Gmousse / dataframe-js

No Maintenance Intended
https://gmousse.gitbooks.io/dataframe-js/
MIT License
460 stars 38 forks source link

Easier iteration over rows #58

Closed falconair closed 6 years ago

falconair commented 6 years ago

Hi, very nice project! I'm using this API in a web application (vue.js) where I need to filter some rows, select some columns and iterate over the results. When I call toDict() on the dataframe and iterate over the results, it returns the columns in order. I expected it to return rows, one by one.

Edit: I noticed that df.toArray() does return rows as array of values. I expected toDict() to also iterate over rows, but where each row is a named object and the names come from column names. This way, I can store data effeciently in a dataframe, without having names attached to each row, but when I want to iterate, names are added dynamically at run-time.

Edit: df.toCollection() does what I want. Should have read the docs better!

Gmousse commented 6 years ago

you can also iterate with a for loop or just use [...yourDf :D]