diff --git a/CHANGELOG.md b/CHANGELOG.md index 46dcb64..59854bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -200,4 +200,3 @@ This project adheres to [Semantic Versioning](http://semver.org/). [0.6.0]:https://github.com/kniren/gota/compare/v0.5.0...v0.6.0 [0.7.0]:https://github.com/kniren/gota/compare/v0.6.0...v0.7.0 [0.8.0]:https://github.com/kniren/gota/compare/v0.7.0...v0.8.0 -[0.9.0]:https://github.com/kniren/gota/compare/v0.8.0...v0.9.0 diff --git a/README.md b/README.md index c2ef493..88bb09e 100644 --- a/README.md +++ b/README.md @@ -260,8 +260,8 @@ mean := func(s series.Series) series.Series { } return series.Floats(sum / float64(len(floats))) } -df.Capply(mean) -df.Rapply(mean) +df.Cbind(mean) +df.Rbind(mean) ``` #### Chaining operations diff --git a/dataframe/dataframe.go b/dataframe/dataframe.go index db7511e..5a5a4cb 100644 --- a/dataframe/dataframe.go +++ b/dataframe/dataframe.go @@ -13,7 +13,7 @@ import ( "strings" "unicode/utf8" - "github.com/go-gota/gota/series" + "github.com/kniren/gota/series" ) // DataFrame is a data structure designed for operating on table like data (Such @@ -962,12 +962,10 @@ func LoadRecords(records [][]string, options ...LoadOption) DataFrame { t, ok := cfg.types[colname] if !ok { - t = cfg.defaultType - if cfg.detectTypes { - if l, err := findType(rawcol); err != nil { - t = l - } - } + t = cfg.defaultType + if cfg.detectTypes { + t = findType(rawcol) + } } types[i] = t } @@ -1833,7 +1831,7 @@ func parseSelectIndexes(l int, indexes SelectIndexes, colnames []string) ([]int, return idx, nil } -func findType(arr []string) (series.Type, error) { +func findType(arr []string) series.Type { var hasFloats, hasInts, hasBools, hasStrings bool for _, str := range arr { if str == "" || str == "NaN" { @@ -1855,15 +1853,15 @@ func findType(arr []string) (series.Type, error) { } switch { case hasStrings: - return series.String, nil + return series.String case hasBools: - return series.Bool, nil + return series.Bool case hasFloats: - return series.Float, nil + return series.Float case hasInts: - return series.Int, nil + return series.Int default: - return series.String, fmt.Errorf("couldn't detect type") + panic("couldn't detect type") } } diff --git a/series/series.go b/series/series.go index 29e2539..1cb54cc 100644 --- a/series/series.go +++ b/series/series.go @@ -8,7 +8,7 @@ import ( "math" - "gonum.org/v1/gonum/stat" + "github.com/gonum/stat" ) // Series is a data structure designed for operating on arrays of elements that @@ -92,12 +92,12 @@ type Comparator string // Supported Comparators const ( Eq Comparator = "==" // Equal - Neq Comparator = "!=" // Non equal - Greater Comparator = ">" // Greater than - GreaterEq Comparator = ">=" // Greater or equal than - Less Comparator = "<" // Lesser than - LessEq Comparator = "<=" // Lesser or equal than - In Comparator = "in" // Inside + Neq = "!=" // Non equal + Greater = ">" // Greater than + GreaterEq = ">=" // Greater or equal than + Less = "<" // Lesser than + LessEq = "<=" // Lesser or equal than + In = "in" // Inside ) // Type is a convenience alias that can be used for a more type safe way of @@ -107,9 +107,9 @@ type Type string // Supported Series Types const ( String Type = "string" - Int Type = "int" - Float Type = "float" - Bool Type = "bool" + Int = "int" + Float = "float" + Bool = "bool" ) // Indexes represent the elements that can be used for selecting a subset of