Documentation ¶
Index ¶
- func AppendColumns(tbl array.Table, cols ...array.Column) array.Table
- func ColumnsEqual(col1, col2 *array.Column) (bool, string)
- func DropColumns(tbl array.Table, names ...string) array.Table
- func DropNA(tbl array.Table) array.Table
- func FilterRows(tbl array.Table, selector SelectFunc) array.Table
- func ReadCSV(r io.Reader, fields []arrow.Field, opts ...Option) array.Table
- func ReplaceColumn(tbl array.Table, col array.Column) array.Table
- func SelectColumns(tbl array.Table, keep ...string) array.Table
- func TableFromColumns(cols []array.Column) array.Table
- func TablesEqual(tbl1, tbl2 array.Table) (bool, string)
- type ColumnHelper
- func (ch *ColumnHelper) Float32Slices() [][]float32
- func (ch *ColumnHelper) Float64Slices() [][]float64
- func (ch *ColumnHelper) Int16Slices() [][]int16
- func (ch *ColumnHelper) Int32Slices() [][]int32
- func (ch *ColumnHelper) Int64Slices() [][]int64
- func (ch *ColumnHelper) Int8Slices() [][]int8
- func (ch *ColumnHelper) Uint16Slices() [][]uint16
- func (ch *ColumnHelper) Uint32Slices() [][]uint32
- func (ch *ColumnHelper) Uint64Slices() [][]uint64
- func (ch *ColumnHelper) Uint8Slices() [][]uint8
- type Option
- type RecordHelper
- func (rh *RecordHelper) Float32Slice() []float32
- func (rh *RecordHelper) Float64Slice() []float64
- func (rh *RecordHelper) Int16Slice() []int16
- func (rh *RecordHelper) Int32Slice() []int32
- func (rh *RecordHelper) Int64Slice() []int64
- func (rh *RecordHelper) Int8Slice() []int8
- func (rh *RecordHelper) SetName(name string)
- func (rh *RecordHelper) SetPos(pos int)
- func (rh *RecordHelper) StringSlice() []string
- func (rh *RecordHelper) Uint16Slice() []uint16
- func (rh *RecordHelper) Uint32Slice() []uint32
- func (rh *RecordHelper) Uint64Slice() []uint64
- func (rh *RecordHelper) Uint8Slice() []uint8
- type SelectFunc
- type SliceHelper
- func (sh *SliceHelper) Float32Column(x [][]float32, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Float64Column(x [][]float64, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Int16Column(x [][]int16, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Int32Column(x [][]int32, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Int64Column(x [][]int64, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Int8Column(x [][]int8, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Uint16Column(x [][]uint16, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Uint32Column(x [][]uint32, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Uint64Column(x [][]uint64, valid [][]bool, name string) *array.Column
- func (sh *SliceHelper) Uint8Column(x [][]uint8, valid [][]bool, name string) *array.Column
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendColumns ¶
AppendColumns returns a table that contains the columns of the provided table, and appends the given additional columns. These new columns must not have the same name as any existing columns.
func ColumnsEqual ¶
ColumnsEqual returns a boolean indicating whether the data in the two given columns are equal. If the data are not equal, a brief message describing the difference is returned.
func DropColumns ¶
DropColumns returns a table that contains the columns of the provided table, except for the columns with the given names.
func DropNA ¶
DropNA drops all rows from the table that contain at least one null value.
Example ¶
var sh SliceHelper col1 := sh.Float64Column([][]float64{{0, 1, 2, 3}}, [][]bool{{true, true, false, true}}, "x") col2 := sh.Int16Column([][]int16{{0, 1, 2, 3}}, [][]bool{{false, true, false, true}}, "y") tbl1 := TableFromColumns([]array.Column{*col1, *col2}) tbl2 := DropNA(tbl1) fmt.Printf("%d %d", tbl2.NumRows(), tbl2.NumCols())
Output: 2 2
func FilterRows ¶
func FilterRows(tbl array.Table, selector SelectFunc) array.Table
FilterRows selects a subset of the rows of a table. Rows where the selector function is false are dropped.
func ReadCSV ¶
ReadCSV is a CSV reader that produces a arrow Table from the data in a CSV source. If a header row is present, the provided Schema can contain only a subset of the columns in the file, and only those columns are retained. If there is no header, then the length of the schema should match the number of columns in the source file.
func ReplaceColumn ¶
ReplaceColumn returns a new table in which one column is replaced with a given column. The name of the given column must match the name of one column in the provided table.
func SelectColumns ¶
SelectColumns returns a Table whose columns are a subset of the columns of the provided table. The retained columns are shallow copies of the source columns.
func TableFromColumns ¶
TableFromColumns creates an array.Table from the given columns.
Example ¶
var sh SliceHelper col1 := sh.Float32Column([][]float32{{4, 1, 3}, {2, 5}}, nil, "col1") col2 := sh.Float32Column([][]float32{{0, 1, 2}, {3, 4}}, nil, "col2") col3 := sh.Float32Column([][]float32{{5, 2, 3}, {4, 1}}, nil, "col3") tbl := TableFromColumns([]array.Column{*col1, *col2, *col3}) fmt.Printf("%d %d", tbl.NumRows(), tbl.NumCols())
Output: 5 3
Types ¶
type ColumnHelper ¶
type ColumnHelper struct {
// contains filtered or unexported fields
}
func NewColumnHelper ¶
func NewColumnHelper(col *array.Column) *ColumnHelper
NewColumnHelper creates a ColumnHelper for the given column. It can be used to extract data from the column as raw slices.
func (*ColumnHelper) Float32Slices ¶
func (ch *ColumnHelper) Float32Slices() [][]float32
Float32Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Float64Slices ¶
func (ch *ColumnHelper) Float64Slices() [][]float64
Float64Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Int16Slices ¶
func (ch *ColumnHelper) Int16Slices() [][]int16
Int16Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Int32Slices ¶
func (ch *ColumnHelper) Int32Slices() [][]int32
Int32Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Int64Slices ¶
func (ch *ColumnHelper) Int64Slices() [][]int64
Int64Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Int8Slices ¶
func (ch *ColumnHelper) Int8Slices() [][]int8
Int8Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Uint16Slices ¶
func (ch *ColumnHelper) Uint16Slices() [][]uint16
Uint16Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Uint32Slices ¶
func (ch *ColumnHelper) Uint32Slices() [][]uint32
Uint32Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Uint64Slices ¶
func (ch *ColumnHelper) Uint64Slices() [][]uint64
Uint64Column returns a slice of slices holding the data from the given column.
func (*ColumnHelper) Uint8Slices ¶
func (ch *ColumnHelper) Uint8Slices() [][]uint8
Uint8Column returns a slice of slices holding the data from the given column.
type Option ¶
type Option func(*reader)
Option provides a configuration option for the CSV reader.
func WithComma ¶
WithComma defines a delimiter to the underlying csv reader. If not set, the delimiter is a comma.
func WithComment ¶
WithComment provides a comment symbol to the underlying csv reader.
type RecordHelper ¶
type RecordHelper struct {
// contains filtered or unexported fields
}
func NewRecordHelper ¶
func NewRecordHelper(rec array.Record) *RecordHelper
NewRecordHelper returns a RecordHelper that can obtain data slices from the given Record.
func (*RecordHelper) Float32Slice ¶
func (rh *RecordHelper) Float32Slice() []float32
GetFloat32SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Float64Slice ¶
func (rh *RecordHelper) Float64Slice() []float64
GetFloat64SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Int16Slice ¶
func (rh *RecordHelper) Int16Slice() []int16
GetInt16SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Int32Slice ¶
func (rh *RecordHelper) Int32Slice() []int32
GetInt32SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Int64Slice ¶
func (rh *RecordHelper) Int64Slice() []int64
GetInt64SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Int8Slice ¶
func (rh *RecordHelper) Int8Slice() []int8
GetInt8SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) SetName ¶
func (rh *RecordHelper) SetName(name string)
SetName sets the column name from which the next SliceFromRecord call will return data.
func (*RecordHelper) SetPos ¶
func (rh *RecordHelper) SetPos(pos int)
SetPos sets the column position from which the next SliceFromRecord call will return data.
func (*RecordHelper) StringSlice ¶
func (rh *RecordHelper) StringSlice() []string
func (*RecordHelper) Uint16Slice ¶
func (rh *RecordHelper) Uint16Slice() []uint16
GetUint16SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Uint32Slice ¶
func (rh *RecordHelper) Uint32Slice() []uint32
GetUint32SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Uint64Slice ¶
func (rh *RecordHelper) Uint64Slice() []uint64
GetUint64SliceFromRecord returns a slice corresponding to the given column position in the given record.
func (*RecordHelper) Uint8Slice ¶
func (rh *RecordHelper) Uint8Slice() []uint8
GetUint8SliceFromRecord returns a slice corresponding to the given column position in the given record.
type SelectFunc ¶
SelectFunc is a function that uses the provided, pre-allocated boolean array to specify which rows of the data chunk are selected.
type SliceHelper ¶
type SliceHelper struct { }
func (*SliceHelper) Float32Column ¶
ColumnFromFloat32Slices returns a pointer to an array.Column value that holds the given float32 data.
func (*SliceHelper) Float64Column ¶
ColumnFromFloat64Slices returns a pointer to an array.Column value that holds the given float64 data.
func (*SliceHelper) Int16Column ¶
ColumnFromInt16Slices returns a pointer to an array.Column value that holds the given int16 data.
func (*SliceHelper) Int32Column ¶
ColumnFromInt32Slices returns a pointer to an array.Column value that holds the given int32 data.
func (*SliceHelper) Int64Column ¶
ColumnFromInt64Slices returns a pointer to an array.Column value that holds the given int64 data.
func (*SliceHelper) Int8Column ¶
ColumnFromInt8Slices returns a pointer to an array.Column value that holds the given int8 data.
func (*SliceHelper) Uint16Column ¶
ColumnFromUint16Slices returns a pointer to an array.Column value that holds the given uint16 data.
func (*SliceHelper) Uint32Column ¶
ColumnFromUint32Slices returns a pointer to an array.Column value that holds the given uint32 data.
func (*SliceHelper) Uint64Column ¶
ColumnFromUint64Slices returns a pointer to an array.Column value that holds the given uint64 data.
func (*SliceHelper) Uint8Column ¶
ColumnFromUint8Slices returns a pointer to an array.Column value that holds the given uint8 data.