1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
// GENERATED CODE, DO NOT EDIT
package dstream
import (
"time"
)
// MemCopy returns a Dstream that copies the provided Dstream into
// in-memory storage. Pass reset as true to reset the source
// data before copying
func MemCopy(data Dstream, reset bool) Dstream {
nvar := data.NumVar()
bdata := make([][]interface{}, nvar)
if reset {
data.Reset()
}
for data.Next() {
for j := 0; j < nvar; j++ {
var y interface{}
v := data.GetPos(j)
switch v := v.(type) {
case []string:
z := make([]string, len(v))
copy(z, v)
y = z
case []time.Time:
z := make([]time.Time, len(v))
copy(z, v)
y = z
case []uint8:
z := make([]uint8, len(v))
copy(z, v)
y = z
case []uint16:
z := make([]uint16, len(v))
copy(z, v)
y = z
case []uint32:
z := make([]uint32, len(v))
copy(z, v)
y = z
case []uint64:
z := make([]uint64, len(v))
copy(z, v)
y = z
case []int8:
z := make([]int8, len(v))
copy(z, v)
y = z
case []int16:
z := make([]int16, len(v))
copy(z, v)
y = z
case []int32:
z := make([]int32, len(v))
copy(z, v)
y = z
case []int64:
z := make([]int64, len(v))
copy(z, v)
y = z
case []float32:
z := make([]float32, len(v))
copy(z, v)
y = z
case []float64:
z := make([]float64, len(v))
copy(z, v)
y = z
}
bdata[j] = append(bdata[j], y)
}
}
da := &DataFrame{
data: bdata,
xform: xform{
names: data.Names(),
},
}
da.init()
return da
}
|