dataframe-go | DataFrames for Go: For statistics, machine-learning, and data manipulation/exploration
kandi X-RAY | dataframe-go Summary
kandi X-RAY | dataframe-go Summary
Dataframes are used for statistics, machine-learning, and data manipulation/exploration. You can think of a Dataframe as an excel spreadsheet. This package is designed to be light-weight and intuitive. ️ The package is production ready but the API is not stable yet. Once stability is reached, version 1.0.0 will be tagged. It is recommended your package manager locks to a commit id instead of the master branch directly. ️. the project to show your appreciation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dataframe-go
dataframe-go Key Features
dataframe-go Examples and Code Snippets
Community Discussions
Trending Discussions on dataframe-go
QUESTION
I have a data frame
...ANSWER
Answered 2021-Jan-16 at 11:17TL;DR
The return type of func readFile(fileName string)
should be *dataframe.DataFrame
.
Reasoning
You use the imports.LoadFromCSV(...)
function to load your CSV file and want to return the resulting data frame. The API documentation of the github.com/rocketlaunchr/dataframe-go
reveals, that LoadFromCSV
function a pointer to your dataframe: *dataframe.DataFrame
.
See documentation here documentation of LoadFromCSV:
func LoadFromCSV(ctx context.Context, r io.ReadSeeker, options ...CSVLoadOptions) (*dataframe.DataFrame, error)
\LoadFromCSV will load data from a csv file.
QUESTION
I'm trying to do a simple filter in dataframe-go
. I adapted from the Github example and tried to use a simple >
operator in the Filter Function, but the compiler gave invalid operation: vals["day"] > 4 (operator > not defined on interface)
error (see my code below)
Ok, so I changed the type to map[string]int64
but then, it gave the error: cannot convert func literal (type func(map[string]int64, int, int) (dataframe.FilterAction, error)) to type dataframe.FilterDataFrameFn
.
I'm very familiar with R DataFrame/Table and Pandas but dataframe-go
's API is rather convoluted. The only web resource I found is this but the author also stated he couldn't understand the filter API.
Any help is appreciated, thanks!
...ANSWER
Answered 2020-Apr-20 at 19:22You have to pass a function with the required signature, so vals
must be a map[interface{}]interface{}
. This is required because Go is not an interpreted language, and the code calling that function you passed as an argument has no compile-time knowledge of the function passed in.
Since your values are interface{}
s, you have to convert them to the correct type to operate with them:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dataframe-go
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page