go-gota / gota

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

Unable to resolve some Dataframe method names #211

Open V4G4X opened 1 year ago

V4G4X commented 1 year ago

I am using the Dataframe struct.
I was using some of it's methods and they were compiling. But a certain method colIndex seems to be unresolvable.

Code:

func MapColumnNamesToIndex(df dataframe.DataFrame, columnNames []string) map[string]int {
    colIndexMap := make(map[string]int)
    for _, colName := range columnNames {
        if index := df.colIndex(colName); index != -1 {
            colIndexMap[colName] = index
        }
    }
    return colIndexMap
}

Basically just creating a map from the column names to the indexes.

However I get the following error when compiling:

../../utils/tagUtils.go:66:18: df.colIndex undefined (type dataframe.DataFrame has no field or method colIndex)

I find this very weird, for now I have a workaround where I'm copy-pasting the implementation of colIndex,
But a better fix would be much preferred.

V4G4X commented 1 year ago

Mind you, the other methods are compiling in the other functions.

amery commented 1 year ago

You can only call exported methods, that is methods starting with a Capital letter