MCPcopy Create free account
hub / github.com/datasweet/datatable / AddColumn

Method AddColumn

mutate_column.go:61–80  ·  view source on GitHub ↗

AddColumn to datatable with a serie of T

(name string, ctyp ColumnType, opt ...ColumnOption)

Source from the content-addressed store, hash-verified

59
60// AddColumn to datatable with a serie of T
61func (t *DataTable) AddColumn(name string, ctyp ColumnType, opt ...ColumnOption) error {
62 var options ColumnOptions
63 for _, o := range opt {
64 o(&options)
65 }
66
67 // create serie based on ctyp
68 sr, err := newColumnSerie(ctyp, options)
69 if err != nil {
70 return errors.Wrap(err, ErrCreateSerie.Error())
71 }
72
73 return t.addColumn(&column{
74 name: strings.TrimSpace(name),
75 typ: ctyp,
76 serie: sr,
77 hidden: options.Hidden,
78 formulae: strings.TrimSpace(options.Expr),
79 })
80}
81
82// RenameColumn to rename a column
83func (t *DataTable) RenameColumn(old, name string) error {

Callers 15

TestNewTableFunction · 0.80
TestNewRowFunction · 0.80
TestExprColumnFunction · 0.80
TestAppendRowFunction · 0.80
TestRowsFunction · 0.80
TestRowFunction · 0.80
TestSwapRowFunction · 0.80
NewFunction · 0.80
TestSwapColumnFunction · 0.80
sampleForExportFunction · 0.80
sampleForJoinFunction · 0.80
TestInnerJoinFunction · 0.80

Calls 2

addColumnMethod · 0.95
newColumnSerieFunction · 0.85

Tested by 15

TestNewTableFunction · 0.64
TestNewRowFunction · 0.64
TestExprColumnFunction · 0.64
TestAppendRowFunction · 0.64
TestRowsFunction · 0.64
TestRowFunction · 0.64
TestSwapRowFunction · 0.64
NewFunction · 0.64
TestSwapColumnFunction · 0.64
sampleForExportFunction · 0.64
sampleForJoinFunction · 0.64
TestInnerJoinFunction · 0.64