Comments (10)
would you like tell how to convert dataframe to gonum dense matrix ?
Can you use SeriesFloat64 to interact with gonum? The float64 slice is exported for that purpose.
and how to use LoadFromCSV(ctx,strings.NewReader(csvStr)),which ctx ,how to define the context.Context
This is a Go question. Not a dataframe question. import context
and use context.Background()
if you are unsure.
from dataframe-go.
context.Background()
thx,you have tell me the context use ,LoadFromCSV(ctx,strings.NewReader(csvStr))
but dataframe all data convert to gonum dense matrix also has problem
I use dataframe.SeriesFloat64 variable to create Dataframe,like this
var s1 *dataframe.SeriesFloat64 = dataframe.NewSeriesFloat64("day", nil, 1, 2, 3, 4, 5, 6, 7, 8)
var s2 *dataframe.SeriesFloat64 = dataframe.NewSeriesFloat64("day3", nil, 1, 2, 3, 4, 5, 6, 7, 8)
var dfs *dataframe.DataFrame = dataframe.NewDataFrame(s1,s2)
,but I dont know how to operate dataframe dfs, I check your source code
when you create dataframe ,the input param tyep is [Series Array ]!!! dataframe.NewDataFrame(s1,s2) ,
func NewDataFrame(se ...Series) *DataFrame
but when I want to get dataframe series array ,
series := dfs.Series
then convert series array to dataframe.SeriesFloat64 array , run the program tell me
【dataframe.SeriesFloat64 not implement Series !!!!】 and Series type has not property like values() method to get []float64 array return, oh my god ,
would you like tell me how to convert the dataframe to gonum dense matrix ,please give me some example code ,thx
from dataframe-go.
would you like tell how to convert dataframe to gonum dense matrix ?
Can you use SeriesFloat64 to interact with gonum? The float64 slice is exported for that purpose.
and how to use LoadFromCSV(ctx,strings.NewReader(csvStr)),which ctx ,how to define the context.Context
This is a Go question. Not a dataframe question. import
context
and usecontext.Background()
if you are unsure.
I write code like this
"""
func series_convert_floatarray( df *dataframe.DataFrame) []float64{
series := df.Series
arr := make([]float64,len(df.Names())*df.NRows())
for _,data :=range series{
//this has error ,data Series type can not convert to dataframe.SeriesFloat64
tem_arr := (dataframe.SeriesFloat64)data
arr = append(arr,tem_arr.Values )
}
return arr
}
"""
then create dense matrix
"""
import "gonum.org/v1/gonum/mat"
arr := series_cov_arr(dfz)
var mars = mat.NewDense(dfz.NRows(),len(dfz.Names()), arr)
"""
from dataframe-go.
df.Series[0].(*SeriesFloat64).Values
from dataframe-go.
df.Series[0].(SeriesFloat64).Values
dataframe.SeriesFloat64 does not implement dataframe.Series (Append method has pointer receiver)
cant use it
from dataframe-go.
Try above now
from dataframe-go.
Try above now
ok ,perfect solve it ,thx
from dataframe-go.
I think maybe you need to add one method like this ,maybe convenient the user like me ,these method is base on python pandas ,
func (df *dataframe.DataFrame ) get_row(row int )[]float64{
series := df.Series
arr := make([]float64,0)
for _,data :=range series{
arr =append(arr,data.Value(row).(float64))
}
return arr
}
func ( df *dataframe.DataFrame) series_convert_floatarray() []float64{
series := df.Series
arr := make([]float64,0)
for _,data :=range series{
tem_arr := data.(*dataframe.SeriesFloat64).Values
arr = append(arr,tem_arr...)
}
return arr
}
func ( df *dataframe.DataFrame) convert_dense_matrix(row ,columns){
....}
from dataframe-go.
Your using the package wrong. Go is not a language you can just start using quickly.
from dataframe-go.
Your using the package wrong. Go is not a language you can just start using quickly.
I know you say ,but I has used java scala python c++ c# in my company project ,first time use golang just want to use machine learning project ,I need numpy pandas instead of in golang ,so do that
from dataframe-go.
Related Issues (20)
- CSV import does not support dictated type for fields with potential empty values HOT 2
- undefined: dataframe.LoadFromCSV HOT 5
- Reading from Parquet HOT 11
- Export to Parquet example HOT 1
- Draw graphs from columns of dataframe HOT 9
- Appending a dataframe with another one. HOT 1
- How to set_index with two columns? HOT 2
- LoadFromJSON Not Working HOT 8
- How to remove duplicate rows in DataFrame? HOT 1
- Problem getting the package HOT 4
- is group by supported? HOT 1
- Bad import, was an upstream dependency deleted? HOT 5
- Error to read parquet with latest parquet-go HOT 21
- Error to read csv encoding utf-8 with bom and export back to parquet HOT 28
- Indirect dependency `github.com/blend/go-sdk v1.1.1` does not exist HOT 6
- Error to import csv, raised parquet-go error HOT 4
- Progress for re-write of dataframe-go? HOT 14
- DF Practice
- Add equivalent of `pandas`.`read_html`
- how to achieve multi index ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataframe-go.