go-gota / gota

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

Question about Type Accessor/conversion method #46

Closed szaydel closed 6 years ago

szaydel commented 6 years ago

So while this is intentional, I wanted to make sure I understand reasoning before deciding how to work with this. Whereas Float() for example does not have two return parameters, Int() and Bool() do. What was the thinking there? Is the idea that some of these conversions more fellable than others?

// Accessor/conversion methods
Copy() Element     // FIXME: Returning interface is a recipe for pain
Val() ElementValue // FIXME: Returning interface is a recipe for pain
String() string
Int() (int, error)
Float() float64
Bool() (bool, error)

Thanks a lot, sorry if I am being dense...

kniren commented 6 years ago

Ints and bools don't have any way of representing values such as NA/NaN but floats do support it, hence the error returns for those cases.

I'm closing this issue, but feel free to comment here if you have further questions regarding this.

szaydel commented 6 years ago

Yep, good. That's what I assumed was the reason, but they say assumptions are bad for business. :)

Thanks a lot!