Documentation
¶
Overview ¶
Package series defines the Series, a typed 1-dimensional data structure with an n-level index, analogous to a column in a spreadsheet.
Index ¶
- func Equal(s1, s2 *Series) bool
- type Config
- type Element
- type Grouping
- func (g Grouping) First() *Series
- func (g Grouping) Group(label string) *Series
- func (g Grouping) Groups() []string
- func (g Grouping) Last() *Series
- func (g Grouping) Len() int
- func (g Grouping) Max() *Series
- func (g Grouping) Mean() *Series
- func (g Grouping) Median() *Series
- func (g Grouping) Min() *Series
- func (g Grouping) Std() *Series
- func (g Grouping) String() string
- func (g Grouping) Sum() *Series
- type InPlace
- func (ip InPlace) Append(val interface{}, idx ...interface{}) error
- func (ip InPlace) Apply(fn func(interface{}) interface{})
- func (ip InPlace) Drop(row int) error
- func (ip InPlace) DropDuplicates()
- func (ip InPlace) DropNull()
- func (ip InPlace) DropRows(rowPositions []int) error
- func (ip InPlace) Insert(pos int, val interface{}, idxLabels ...interface{}) error
- func (ip InPlace) Join(s2 *Series) error
- func (ip InPlace) Len() int
- func (ip InPlace) Less(i, j int) bool
- func (ip InPlace) Set(row int, val interface{}) error
- func (ip InPlace) SetRows(rowPositions []int, val interface{}) error
- func (ip InPlace) Sort(asc bool)
- func (ip InPlace) String() string
- func (ip InPlace) Subset(rowPositions []int) error
- func (ip InPlace) Swap(i, j int)
- func (ip InPlace) ToBool()
- func (ip InPlace) ToDateTime()
- func (ip InPlace) ToFloat64()
- func (ip InPlace) ToInt64()
- func (ip InPlace) ToInterface()
- func (ip InPlace) ToString()
- type Index
- func (idx Index) AppendLevel(values interface{}, name string) error
- func (idx Index) At(row int, level int) interface{}
- func (idx Index) Convert(dataType string, level int) error
- func (idx Index) DropLevel(level int) error
- func (idx Index) DropNull(level int) error
- func (idx Index) Filter(level int, cmp func(interface{}) bool) []int
- func (idx Index) Flip(level int) (*Series, error)
- func (idx Index) InsertLevel(pos int, values interface{}, name string) error
- func (idx Index) Len() int
- func (idx Index) Less(i, j int) bool
- func (idx Index) Reindex(level int) error
- func (idx Index) RenameLevel(level int, name string) error
- func (idx Index) SelectName(name string) int
- func (idx Index) SelectNames(names []string) []int
- func (idx Index) Set(row int, level int, val interface{}) error
- func (idx Index) Sort(asc bool)
- func (idx Index) String() string
- func (idx Index) SubsetLevels(levelPositions []int) error
- func (idx Index) Swap(i, j int)
- func (idx Index) SwapLevels(i, j int) error
- func (idx Index) Values() [][]interface{}
- type Series
- func (s *Series) After(t time.Time) []int
- func (s *Series) Append(val interface{}, idxLabels ...interface{}) (*Series, error)
- func (s *Series) Apply(fn func(interface{}) interface{}) *Series
- func (s *Series) At(position int) interface{}
- func (s *Series) Before(t time.Time) []int
- func (s *Series) Contains(substr string) []int
- func (s *Series) Convert(datatype string) *Series
- func (s *Series) Copy() *Series
- func (s *Series) DataType() string
- func (s *Series) Describe()
- func (s *Series) Drop(row int) (*Series, error)
- func (s *Series) DropDuplicates() *Series
- func (s *Series) DropNull() *Series
- func (s *Series) DropRows(positions []int) (*Series, error)
- func (s *Series) EQ(comparison float64) []int
- func (s *Series) Earliest() time.Time
- func (s *Series) Element(position int) Element
- func (s *Series) False() []int
- func (s *Series) Filter(cmp func(interface{}) bool) []int
- func (s *Series) From(start int, end int) *Series
- func (s *Series) GT(comparison float64) []int
- func (s *Series) GTE(comparison float64) []int
- func (s *Series) GroupByIndex(levelPositions ...int) Grouping
- func (s *Series) InList(list []string) []int
- func (s *Series) Insert(pos int, val interface{}, idxLabels ...interface{}) (*Series, error)
- func (s *Series) Join(s2 *Series) (*Series, error)
- func (s *Series) LT(comparison float64) []int
- func (s *Series) LTE(comparison float64) []int
- func (s *Series) Latest() time.Time
- func (s *Series) Len() int
- func (s *Series) LookupSeries(s2 *Series) *Series
- func (s *Series) Max() float64
- func (s *Series) MaxWidth() int
- func (s *Series) Mean() float64
- func (s *Series) Median() float64
- func (s *Series) Min() float64
- func (s *Series) NEQ(comparison float64) []int
- func (s Series) Name() string
- func (s *Series) NumLevels() int
- func (s *Series) Quartile(i int) float64
- func (s *Series) Rename(name string)
- func (s *Series) SelectLabel(label string) int
- func (s *Series) SelectLabels(labels []string, level int) []int
- func (s *Series) Set(row int, val interface{}) (*Series, error)
- func (s *Series) SetRows(rowPositions []int, val interface{}) (*Series, error)
- func (s *Series) Sort(asc bool) *Series
- func (s *Series) Std() float64
- func (s *Series) String() string
- func (s *Series) Subset(rowPositions []int) (*Series, error)
- func (s *Series) Sum() float64
- func (s *Series) Swap(i, j int) (*Series, error)
- func (s *Series) ToBool() *Series
- func (s *Series) ToDateTime() *Series
- func (s *Series) ToFloat64() *Series
- func (s *Series) ToInt64() *Series
- func (s *Series) ToInterface() *Series
- func (s *Series) ToInternalComponents() (values.Container, index.Index)
- func (s *Series) ToString() *Series
- func (s *Series) True() []int
- func (s *Series) Unique() []string
- func (s *Series) Vals() interface{}
- func (s *Series) ValueCounts() map[string]int
- func (s *Series) Values() []interface{}
- func (s *Series) XS(rowPositions []int, levelPositions []int) (*Series, error)
Examples ¶
- Element (Null_printer)
- Element (Valid_printer)
- Grouping (Method_list)
- InPlace (Method_list)
- Index (Valid_printer)
- New (Config_datatype)
- New (Config_indexName)
- New (Config_nameOnly)
- New (Datetime_manyRows)
- New (Datetime_single)
- New (Exceed_maxRows_even)
- New (Exceed_maxRows_odd)
- New (Float_precision)
- New (MaxWidth_index)
- New (MaxWidth_value)
- New (Named_later)
- New (Nonsequential_repeating)
- New (Partially_named_indexes)
- New (Repeating_allowed)
- New (Repeating_multiIndex)
- New (Repeating_singleIndex)
- New (String)
- New (String_multiIdx)
- New (String_multiIdx_named_sequential_repeating)
- New (String_named)
- New (String_singleIdx)
- Series (Empty_series)
- Series.Describe (Bool)
- Series.Describe (Datetime)
- Series.Describe (Datetime_empty)
- Series.Describe (Float)
- Series.Describe (Float_empty)
- Series.Describe (Int)
- Series.Describe (Interface)
- Series.Describe (ScalarString)
- Series.Describe (String)
- Series.Describe (String_empty)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Name string
DataType options.DataType
Index interface{}
IndexName string
MultiIndex []interface{}
MultiIndexNames []string
Manual bool
}
The Config struct can be used in the custom Series constructor to name the Series or specify its data type.
type Element ¶
type Element struct {
Value interface{}
Null bool
Labels []interface{}
LabelTypes []options.DataType
}
An Element is a single item in a Series.
Example (Null_printer) ¶
s := MustNew("")
fmt.Println(s.Element(0))
Output: Value: NaN Null: true Labels: [0] LabelTypes: [int64]
Example (Valid_printer) ¶
s := MustNew("foo")
fmt.Println(s.Element(0))
Output: Value: foo Null: false Labels: [0] LabelTypes: [int64]
type Grouping ¶
type Grouping struct {
// contains filtered or unexported fields
}
A Grouping returns a collection of index labels with mutually exclusive integer positions.
Example (Method_list) ¶
s := MustNew(
[]string{"foo", "bar", "baz"},
Config{MultiIndex: []interface{}{[]int{0, 0, 1}, []int{100, 100, 101}}})
g := s.GroupByIndex()
fmt.Println(g)
Output: {Series Grouping | NumGroups: 2, Groups: [0 | 100, 1 | 101]}
func (Grouping) Group ¶
Group returns the Series with the given group label, or an error if that label does not exist.
type InPlace ¶
type InPlace struct {
// contains filtered or unexported fields
}
InPlace contains methods for modifying a Series in place.
Example (Method_list) ¶
s := MustNew("foo")
fmt.Println(s.InPlace)
Output: {InPlace Series Handler} Methods: Append Apply Drop DropDuplicates DropNull DropRows Insert Join Len Less Set SetRows Sort String Subset Swap ToBool ToDateTime ToFloat64 ToInt64 ToInterface ToString
func (InPlace) Append ¶
Append adds a row at a specified integer position and modifies the Series in place.
func (InPlace) Apply ¶
func (ip InPlace) Apply(fn func(interface{}) interface{})
Apply a callback function to every value in a Series and modify the Series in place.
func (InPlace) Drop ¶
Drop drops the row at the specified integer position and modifies the Series in place.
func (InPlace) DropDuplicates ¶
func (ip InPlace) DropDuplicates()
DropDuplicates drops any rows containing duplicate index + Series values and modifies the Series in place.
func (InPlace) DropNull ¶
func (ip InPlace) DropNull()
DropNull drops all null values and modifies the Series in place.
func (InPlace) DropRows ¶
DropRows drops the rows at the specified integer position and modifies the Series in place. If an error would be encountered in any row position, the entire operation is cancelled before it starts.
func (InPlace) Insert ¶
Insert inserts a new row into the Series immediately before the specified integer position and modifies the Series in place. If the original Series is empty, replaces it with a new Series.
func (InPlace) Join ¶
Join converts s2 to the same type as the base Series (s), appends s2 to the end, and modifies s in place.
func (InPlace) Set ¶
Set sets the values in the specified row to val and modifies the Series in place. First converts val to be the same type as the index level.
func (InPlace) SetRows ¶
SetRows sets all the values in the specified rows to val and modifies the Series in place. First converts val to be the same type as the index level. If an error would be encountered in any row position, the entire operation is cancelled before it starts.
func (InPlace) ToDateTime ¶
func (ip InPlace) ToDateTime()
ToDateTime converts Series values to datetime in place.
func (InPlace) ToFloat64 ¶
func (ip InPlace) ToFloat64()
ToFloat64 converts Series values to float64 in place.
func (InPlace) ToInt64 ¶
func (ip InPlace) ToInt64()
ToInt64 converts Series values to int64 in place.
func (InPlace) ToInterface ¶
func (ip InPlace) ToInterface()
ToInterface converts Series values to interface in place.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index contains index selection and conversion
Example (Valid_printer) ¶
s := MustNew([]string{"foo", "bar", "baz"})
fmt.Println(s.Index)
Output: {Series Index | Len: 3, NumLevels: 1}
func (Index) AppendLevel ¶
AppendLevel adds a new index level to the end of the current index and modifies the Series in place.
func (Index) At ¶
At returns the index value at a specified row position and index level but returns nil if either integer is out of range.
func (Index) DropLevel ¶
DropLevel drops the specified index level and modifies the Series in place.
func (Index) DropNull ¶
DropNull drops null index values at the index level specified and modifies the Series in place.
func (Index) Filter ¶
Filter an index level using a callback function test. The Filter function iterates over all index values in interface{} form and applies the callback test to each. The return value is a slice of integer positions of all the rows passing the test. The caller is responsible for handling the type assertion on the interface, though this step is not necessary if the datatype is known with certainty. For example, here are two ways to write a filter that returns all rows with the suffix "boo":
#1 (safer) error check type assertion
s.Index.Filter(0, func(val interface{}) bool {
v, ok := val.(string)
if !ok {
return false
}
if strings.HasSuffix(v, "boo") {
return true
}
return false
})
Input: bamboo 0 leaves 1 taboo 2
Output: []int{0,2}
#2 (riskier) no error check
s.Filter(func(val interface{}) bool {
if strings.HasSuffix(val.(string), "boo") {
return true
}
return false
})
func (Index) Flip ¶
Flip replaces the Series values with the labels at the supplied index level, and vice versa.
func (Index) InsertLevel ¶
InsertLevel inserts a level into the index and modifies the Series in place.
func (Index) Less ¶
Less compares two elements and returns true if the first is less than the second. Required by Sort interface.
func (Index) Reindex ¶
Reindex converts an index level in place to an ordered default range []int{0, 1, 2,...n}
func (Index) RenameLevel ¶
RenameLevel renames an index level in place but does not change anything if level is out of range.
func (Index) SelectName ¶
SelectName returns the integer position of the index level at the first occurrence of the supplied name, or -1 if not a valid index level name.
func (Index) SelectNames ¶
SelectNames returns the integer positions of the index levels with the supplied names.
func (Index) Set ¶
Set sets the label at the specified index row and level to val and modifies the Series in place. First converts val to be the same type as the index level.
func (Index) SubsetLevels ¶
SubsetLevels modifies the Series in place with only the specified index levels.
func (Index) Swap ¶
Swap swaps two labels at index level 0 and modifies the index in place. Required by Sort interface.
func (Index) SwapLevels ¶
SwapLevels swaps two levels in the index and modifies the Series in place.
type Series ¶
A Series is a 1-D data container with a labeled index, static type, and the ability to handle null values
Example (Empty_series) ¶
s := newEmptySeries() fmt.Println(s)
Output: {Empty Series}
func FromInternalComponents ¶
FromInternalComponents is a semi-private method for hydrating Series within the DataFrame module. The required inputs are not available to the caller.
func New ¶
New creates a new Series with the supplied values and an optional config.
Example (Config_datatype) ¶
s := MustNew([]interface{}{"1", "foo"}, Config{DataType: options.Float64})
fmt.Println(s)
Output: 0 1.00 1 NaN datatype: float64
Example (Config_indexName) ¶
s := MustNew([]string{"foo", "bar"}, Config{IndexName: "baz"})
fmt.Println(s)
Output: baz 0 foo 1 bar datatype: string
Example (Config_nameOnly) ¶
s := MustNew([]string{"foo", "bar"}, Config{Name: "baz"})
fmt.Println(s)
Output: 0 foo 1 bar datatype: string name: baz
Example (Datetime_manyRows) ¶
s := MustNew([]time.Time{
time.Date(2019, 5, 1, 15, 9, 30, 30, time.UTC),
time.Date(2019, 5, 2, 15, 15, 55, 55, time.UTC),
})
fmt.Println(s)
Output: 0 5/1/2019T15:09:30 1 5/2/2019T15:15:55 datatype: dateTime
Example (Datetime_single) ¶
s := MustNew([]time.Time{time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)})
fmt.Println(s)
Output: 0 1/1/2019T00:00:00 datatype: dateTime
Example (Exceed_maxRows_even) ¶
options.SetDisplayMaxRows(2)
s := MustNew([]float64{0, 1, 2, 3, 4})
fmt.Println(s)
options.RestoreDefaults()
Output: 0 0.00 ... 4 4.00 datatype: float64
Example (Exceed_maxRows_odd) ¶
options.SetDisplayMaxRows(3)
s := MustNew([]float64{0, 1, 2, 3, 4})
fmt.Println(s)
options.RestoreDefaults()
Output: 0 0.00 1 1.00 ... 4 4.00 datatype: float64
Example (Float_precision) ¶
s := MustNew([]float64{1.5511, 2.6611})
fmt.Println(s)
Output: 0 1.55 1 2.66 datatype: float64
Example (MaxWidth_index) ¶
s := MustNew([]string{"foo", "bar"}, Config{Index: []string{"This is a very long index row. Very long indeed.", "qux"}, IndexName: "baz"})
options.SetDisplayMaxWidth(10)
fmt.Println(s)
options.RestoreDefaults()
Output: baz This is... foo qux bar datatype: string
Example (MaxWidth_value) ¶
s := MustNew([]string{"This is a very long value row. Very long indeed.", "foo"})
fmt.Println(s)
Output: 0 This is a very long value row. V... 1 foo datatype: string
Example (Named_later) ¶
s := MustNew(
[]string{"foo", "bar", "", "baz"},
)
s.Rename("foobar")
fmt.Println(s)
Output: 0 foo 1 bar 2 NaN 3 baz datatype: string name: foobar
Example (Nonsequential_repeating) ¶
s := MustNew(
[]string{"foo", "bar", "", "baz", "qux", "quux"},
Config{
Name: "foobar",
MultiIndex: []interface{}{[]int{0, 0, 1, 1, 0, 0}, []int{10000, 10100, 10200, 10300, 10400, 10500}},
MultiIndexNames: []string{"id", "code"},
},
)
fmt.Println(s)
Output: id code 0 10000 foo 10100 bar 1 10200 NaN 10300 baz 0 10400 qux 10500 quux datatype: string name: foobar
Example (Partially_named_indexes) ¶
s := MustNew(
[]string{"foo", "bar"},
Config{
MultiIndex: []interface{}{
[]int{0, 1},
[]int{10000, 10100}},
MultiIndexNames: []string{"", "code"},
Name: "foobar"},
)
fmt.Println(s)
Output: code 0 10000 foo 1 10100 bar datatype: string name: foobar
Example (Repeating_allowed) ¶
options.SetDisplayRepeatedLabels(true)
s := MustNew(
[]string{"foo", "bar", "baz", "qux"},
Config{Index: []int{0, 0, 1, 1}})
fmt.Println(s)
options.RestoreDefaults()
Output: 0 foo 0 bar 1 baz 1 qux datatype: string
Example (Repeating_multiIndex) ¶
s := MustNew(
[]string{"foo", "bar", "baz", "qux"},
Config{MultiIndex: []interface{}{[]int{0, 0, 1, 1}, []string{"A", "A", "B", "B"}}})
fmt.Println(s)
Output: 0 A foo bar 1 B baz qux datatype: string
Example (Repeating_singleIndex) ¶
s := MustNew(
[]string{"foo", "bar", "baz", "qux"},
Config{Index: []int{0, 0, 1, 1}})
fmt.Println(s)
Output: 0 foo bar 1 baz qux datatype: string
Example (String) ¶
[START constructor examples]
s, _ := New([]string{"foo", "bar", "", "baz"})
fmt.Println(s)
Output: 0 foo 1 bar 2 NaN 3 baz datatype: string
Example (String_multiIdx) ¶
s := MustNew(
[]string{"foo", "bar", "", "baz"},
Config{MultiIndex: []interface{}{[]int{0, 1, 2, 3}, []int{100, 101, 102, 103}}})
fmt.Println(s)
Output: 0 100 foo 1 101 bar 2 102 NaN 3 103 baz datatype: string
Example (String_multiIdx_named_sequential_repeating) ¶
s := MustNew(
[]string{"foo", "bar", "", "baz"},
Config{
Name: "foobar",
MultiIndex: []interface{}{[]int{0, 0, 1, 1}, []int{10000, 10100, 10200, 10300}},
MultiIndexNames: []string{"id", "code"},
},
)
fmt.Println(s)
Output: id code 0 10000 foo 10100 bar 1 10200 NaN 10300 baz datatype: string name: foobar
Example (String_named) ¶
s := MustNew([]string{"foo", "bar", "", "baz"}, Config{Name: "foobar"})
fmt.Println(s)
Output: 0 foo 1 bar 2 NaN 3 baz datatype: string name: foobar
Example (String_singleIdx) ¶
s := MustNew([]string{"foo", "bar", "", "baz"}, Config{Index: []int{100, 101, 102, 103}})
fmt.Println(s)
Output: 100 foo 101 bar 102 NaN 103 baz datatype: string
func (*Series) Apply ¶
Apply a callback function to every value in a Series and return a new Series. The Apply function iterates over all Series values in interface{} form and applies the callback function to each. The final values are then converted to match the datatype of the original Series. The caller is responsible for handling the type assertion on the interface, though this step is not necessary if the datatype is known with certainty. For example, here are two ways to write an apply function that computes the z-score of every row and rounds it two decimal points:
#1 (safer) error check type assertion
s.Apply(func(val interface{}) interface{} {
v, ok := val.(float64)
if !ok {
return ""
}
return (v - s.Mean()) / s.Std()
Input: 0 1 1 2 2 3
Output: 0 -1.22... 1 0 2 1.22...
#2 (riskier) no error check
s.Apply(func(val interface{}) interface{} {
return (val.(float64) - s.Mean()) / s.Std()
})
func (*Series) At ¶
At returns the value at a single integer position, bur returns nil if the position is out of range.
func (*Series) DataType ¶
DataType is the data type of the Series' values. Mimics reflect.Type with the addition of time.Time as DateTime.
func (*Series) Describe ¶
func (s *Series) Describe()
Describe the key details of the Series.
Example (Bool) ¶
s, _ := New([]bool{true, false, false})
s.Describe()
Output: len 3 valid 3 null 0 sum 1.00 mean 0.33 datatype: bool
Example (Datetime) ¶
s, _ := New([]time.Time{
time.Date(2019, 4, 18, 15, 0, 0, 0, time.UTC),
time.Date(2019, 4, 19, 15, 0, 0, 0, time.UTC),
time.Time{},
})
s.Describe()
Output: len 3 valid 2 null 1 unique 2 earliest 2019-04-18 15:00:00 +0000 UTC latest 2019-04-19 15:00:00 +0000 UTC datatype: dateTime
Example (Datetime_empty) ¶
s, _ := New([]time.Time{time.Time{}})
s.Describe()
Output: len 1 valid 0 null 1 unique 0 earliest 0001-01-01 00:00:00 +0000 UTC latest 0001-01-01 00:00:00 +0000 UTC datatype: dateTime
Example (Float) ¶
s, _ := New([]float64{1, math.NaN(), 2, 3, 4, 5, math.NaN(), 6, 7, 8, 9})
s.Describe()
Output: len 11 valid 9 null 2 mean 5.00 min 1.00 25% 2.50 50% 5.00 75% 7.50 max 9.00 datatype: float64
Example (Float_empty) ¶
s, _ := New([]float64{})
s.Describe()
Output: len 0 valid 0 null 0 mean NaN min NaN max NaN datatype: float64
Example (Int) ¶
s, _ := New([]int64{1, 2, 3, 4, 5, 6, 7, 8, 9})
s.Describe()
Output: len 9 valid 9 null 0 mean 5.00 min 1.00 25% 2.50 50% 5.00 75% 7.50 max 9.00 datatype: int64
Example (Interface) ¶
s, _ := New([]interface{}{1.5, 1, "", false})
s.Describe()
Output: len 4 valid 3 null 1 datatype: interface
Example (ScalarString) ¶
s, _ := New("foo")
s.name = "bar"
s.Describe()
Output: len 1 valid 1 null 0 unique 1 datatype: string name: bar
Example (String) ¶
s, _ := New([]string{"low", "medium", "medium", ""})
s.Describe()
Output: len 4 valid 3 null 1 unique 2 datatype: string
Example (String_empty) ¶
s, _ := New([]string{"", ""})
s.Describe()
Output: len 2 valid 0 null 2 unique 0 datatype: string
func (*Series) Drop ¶
Drop drops the row at the specified integer position and returns a new Series.
func (*Series) DropDuplicates ¶
DropDuplicates drops any rows containing duplicate index + Series values and returns a new Series.
func (*Series) DropRows ¶
DropRows drops the rows at the specified integer position and returns a new Series.
func (*Series) Earliest ¶
Earliest returns the earliest non-null time.Time{} in the Series. If applied to anything other than dateTime, return time.Time{}.
func (*Series) Element ¶
Element returns information about the value and index labels at this position but panics if an out-of-range position is provided.
func (*Series) Filter ¶
Filter a Series using a callback function test. The Filter function iterates over all Series values in interface{} form and applies the callback test to each. The return value is a slice of integer positions of all the rows passing the test. The caller is responsible for handling the type assertion on the interface, though this step is not necessary if the datatype is known with certainty. For example, here are two ways to write a filter that returns all rows with the suffix "boo":
#1 (safer) error check type assertion
s.Filter(func(val interface{}) bool {
v, ok := val.(string)
if !ok {
return false
}
if strings.HasSuffix(v, "boo") {
return true
}
return false
})
Input: 0 bamboo 1 leaves 2 taboo
Output: []int{0,2}
#2 (riskier) no error check
s.Filter(func(val interface{}) bool {
if strings.HasSuffix(val.(string), "boo") {
return true
}
return false
})
func (*Series) From ¶
From subsets the Series from start to end (inclusive) and returns a new Series. If an invalid position is provided, returns empty Series.
func (*Series) GroupByIndex ¶
GroupByIndex groups a Series by one or more of its index levels. If no int is provided, all index levels are used.
func (*Series) Insert ¶
Insert inserts a new row into the Series immediately before the specified integer position and returns a new Series.
func (*Series) Join ¶
Join converts s2 to the same type as the base Series (s), appends s2 to the end, and returns a new Series.
func (*Series) Latest ¶
Latest returns the latest non-null time.Time{} in the Series. If applied to anything other than dateTime, return time.Time{}.
func (*Series) LookupSeries ¶
LookupSeries performs a vlookup of each values in one Series against another Series.
func (*Series) Max ¶
Max of a series. Applies to float64 and int64. If inapplicable, defaults to math.Nan().
func (*Series) MaxWidth ¶
MaxWidth returns the max number of characters in any value in the Series. For use in printing Series.
func (*Series) Mean ¶
Mean of non-null series values. For bool values, mean of true values. Applies to float64 and int64. If inapplicable, defaults to math.Nan().
func (*Series) Median ¶
Median of a series. Applies to float64 and int64. If inapplicable, defaults to math.Nan().
func (*Series) Min ¶
Min of a series. Applies to float64 and int64. If inapplicable, defaults to math.Nan().
func (*Series) Quartile ¶
Quartile returns the data's ith quartile point. 1: median between min and median, 2: median, 3: median between median and max. Applies to float and int. If inapplicable, defaults to math.Nan().
func (*Series) SelectLabel ¶
SelectLabel returns the integer location of the first row in index level 0 with the supplied label, or -1 if the label does not exist.
func (*Series) SelectLabels ¶
SelectLabels returns the integer locations of all rows with the supplied labels within the supplied level. If an error is encountered, returns a new slice of 0 length.
func (*Series) SetRows ¶
SetRows sets all the values in the specified rows to val and returns a new Series.
func (*Series) Std ¶
Std returns the Standard Deviation of a series.
Applies to: Float, Int. If inapplicable, defaults to math.Nan().
func (*Series) Subset ¶
Subset subsets a Series based on the supplied integer positions and returns a new Series.
func (*Series) Sum ¶
Sum of non-null float64 or int64 Series values. For bool values, sum of true values. If inapplicable, defaults to math.Nan().
func (*Series) ToDateTime ¶
ToDateTime converts Series values to time.Time and returns a new Series.
func (*Series) ToInterface ¶
ToInterface converts Series values to interface and returns a new Series.
func (*Series) ToInternalComponents ¶
ToInternalComponents is a semi-private method for using a Series within the DataFrame module. The required inputs are not available to the caller.
func (*Series) Unique ¶
Unique returns a de-duplicated list of all non-null values (as []string) that appear in the Series.
func (*Series) Vals ¶
func (s *Series) Vals() interface{}
Vals returns all the values (including null values) in the Series as an interface Use Vals for type assertion.
func (*Series) ValueCounts ¶
ValueCounts returns a map of non-null value labels to number of occurrences in the Series.