go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.97k stars 276 forks source link

Get Values of a Specific Column as Array (without iteration?) #201

Open windowshopr opened 1 year ago

windowshopr commented 1 year ago

I have a dataframe that looks like this:

image

...which I would like to start adding some new technical indicator columns to it, and looking for the easiest way to do it as I'm new to Go.

I would like to make use of the EMA function from this repo which requires the data being passed into the function to be of []float64.

Is there any easier way to convert a column of dataframe.Dataframe type values to an array without just creating an empty array and iterating over the dataframe (as my dataframe is quite large), or is there an even better way to calculate the EMA column for the dataframe? I'm coming from Python where I think I may have been spoiled with this as it was super easy to do there in Pandas, where Go just doesn't seem to have the same tools to do this.

sushantkumr commented 6 months ago

@windowshopr I have a similar requirement. Have you managed to get a solution for this by any chance?

windowshopr commented 6 months ago

Unfortunately no, other than just iterating through row by row, but it's fairly quick in go when compared to python iterating through a data frame.