func (dataset *Dataset) FillRowsWithColumn(colIdx int, col Column) {
	if dataset.GetMode() != DatasetModeRows {
		return
	}
	nrow := dataset.GetNRow()
	emptyAt := nrow
	for x, row := range dataset.Rows {
		if row.IsNilAt(colIdx) {
			emptyAt = x
			break
		}
	}
	y := 0
	for x := emptyAt; x < nrow; x++ {
		dataset.Rows[x].SetValueAt(colIdx, col.Records[y])
		y++
	}
	ncol := dataset.GetNColumn()
	nrow = col.Len()
	for ; y < nrow; y++ {
		row := make(Row, ncol)
		for z := 0; z < ncol; z++ {
			if z == colIdx {
				row[colIdx] = col.Records[y]
			} else {
				row[z] = NewRecord()
			}
		}
		dataset.PushRow(&row)
	}
}
FillRowsWithColumn given a column, fill the dataset with row where the record
only set at index `colIdx`.

Example, content of dataset was,

index:	0 1 2
A B C
X     (step 1) nrow = 2

If we filled column at index 2 with [Y Z], the dataset will become:

index:	0 1 2
A B C
X   Y (step 2) fill the empty row
Z (step 3) create dummy row which contain the rest of column data.
package tabula
import (
	"errors"
	"math"
)
const (
	DatasetNoMode = 0
	DatasetModeRows = 1
	DatasetModeColumns = 2
	DatasetModeMatrix = 4
)
var (
	ErrColIdxOutOfRange = errors.New("tabula: Column index out of range")
	ErrInvalidColType = errors.New("tabula: Invalid column type")
	ErrMisColLength = errors.New("tabula: mismatch on column length")
)
type Dataset struct {
	Mode int
	Columns Columns
	Rows Rows
}
func NewDataset(mode int, types []int, names []string) (
	dataset *Dataset,
) {
	dataset = &Dataset{}
	dataset.Init(mode, types, names)
	return
}
func (dataset *Dataset) Init(mode int, types []int, names []string) {
	if types == nil {
		dataset.Columns = make(Columns, 0)
	} else {
		dataset.Columns = make(Columns, len(types))
		dataset.Columns.SetTypes(types)
	}
	dataset.SetColumnsName(names)
	dataset.SetMode(mode)
}
func (dataset *Dataset) Clone() interface{} {
	clone := NewDataset(dataset.GetMode(), nil, nil)
	for _, col := range dataset.Columns {
		newcol := Column{
			Type:       col.Type,
			Name:       col.Name,
			ValueSpace: col.ValueSpace,
		}
		clone.PushColumn(newcol)
	}
	return clone
}
func (dataset *Dataset) Reset() error {
	dataset.Rows = Rows{}
	dataset.Columns.Reset()
	return nil
}
func (dataset *Dataset) GetMode() int {
	return dataset.Mode
}
func (dataset *Dataset) SetMode(mode int) {
	switch mode {
	case DatasetModeRows:
		dataset.Mode = DatasetModeRows
		dataset.Rows = make(Rows, 0)
	case DatasetModeColumns:
		dataset.Mode = DatasetModeColumns
		dataset.Columns.Reset()
	default:
		dataset.Mode = DatasetModeMatrix
		dataset.Rows = make(Rows, 0)
		dataset.Columns.Reset()
	}
}
func (dataset *Dataset) GetNColumn() (ncol int) {
	ncol = len(dataset.Columns)
	if ncol > 0 {
		return
	}
	if dataset.Mode == DatasetModeRows {
		if len(dataset.Rows) == 0 {
			return 0
		}
		return dataset.Rows[0].Len()
	}
	return
}
func (dataset *Dataset) GetNRow() (nrow int) {
	switch dataset.Mode {
	case DatasetModeRows:
		nrow = len(dataset.Rows)
	case DatasetModeColumns:
		if len(dataset.Columns) == 0 {
			nrow = 0
		} else {
			nrow = dataset.Columns[0].Len()
		}
	case DatasetModeMatrix, DatasetNoMode:
		nrow = len(dataset.Rows)
	}
	return
}
func (dataset *Dataset) Len() int {
	return dataset.GetNRow()
}
func (dataset *Dataset) GetColumnsType() (types []int) {
	for x := range dataset.Columns {
		types = append(types, dataset.Columns[x].Type)
	}
	return
}
func (dataset *Dataset) SetColumnsType(types []int) {
	dataset.Columns = make(Columns, len(types))
	dataset.Columns.SetTypes(types)
}
func (dataset *Dataset) GetColumnTypeAt(idx int) (int, error) {
	if idx >= dataset.GetNColumn() {
		return TUndefined, ErrColIdxOutOfRange
	}
	return dataset.Columns[idx].Type, nil
}
func (dataset *Dataset) SetColumnTypeAt(idx, tipe int) error {
	if idx >= dataset.GetNColumn() {
		return ErrColIdxOutOfRange
	}
	dataset.Columns[idx].Type = tipe
	return nil
}
func (dataset *Dataset) GetColumnsName() (names []string) {
	for x := range dataset.Columns {
		names = append(names, dataset.Columns[x].Name)
	}
	return
}
func (dataset *Dataset) SetColumnsName(names []string) {
	nameslen := len(names)
	if nameslen <= 0 {
		return
	}
	collen := dataset.GetNColumn()
	if collen <= 0 {
		dataset.Columns = make(Columns, nameslen)
		collen = nameslen
	}
	minlen := collen
	if nameslen < collen {
		minlen = nameslen
	}
	for x := 0; x < minlen; x++ {
		dataset.Columns[x].Name = names[x]
	}
}
func (dataset *Dataset) AddColumn(tipe int, name string, vs []string) {
	col := Column{
		Type:       tipe,
		Name:       name,
		ValueSpace: vs,
	}
	dataset.PushColumn(col)
}
func (dataset *Dataset) GetColumn(idx int) (col *Column) {
	if idx > dataset.GetNColumn() {
		return
	}
	switch dataset.Mode {
	case DatasetModeRows:
		dataset.TransposeToColumns()
	case DatasetModeColumns:
	case DatasetModeMatrix:
	}
	return &dataset.Columns[idx]
}
func (dataset *Dataset) GetColumnByName(name string) (col *Column) {
	if dataset.Mode == DatasetModeRows {
		dataset.TransposeToColumns()
	}
	for x, col := range dataset.Columns {
		if col.Name == name {
			return &dataset.Columns[x]
		}
	}
	return
}
func (dataset *Dataset) GetColumns() *Columns {
	return &dataset.Columns
}
func (dataset *Dataset) SetColumns(cols *Columns) {
	dataset.Columns = *cols
}
func (dataset *Dataset) GetRow(idx int) *Row {
	if idx < 0 {
		return nil
	}
	if idx >= dataset.Rows.Len() {
		return nil
	}
	return dataset.Rows[idx]
}
func (dataset *Dataset) GetRows() *Rows {
	return &dataset.Rows
}
func (dataset *Dataset) SetRows(rows *Rows) {
	dataset.Rows = *rows
}
func (dataset *Dataset) GetData() interface{} {
	switch dataset.Mode {
	case DatasetModeRows:
		return &dataset.Rows
	case DatasetModeColumns:
		return &dataset.Columns
	case DatasetModeMatrix, DatasetNoMode:
		return &Matrix{
			Columns: &dataset.Columns,
			Rows:    &dataset.Rows,
		}
	}
	return nil
}
func (dataset *Dataset) GetDataAsRows() *Rows {
	if dataset.Mode == DatasetModeColumns {
		dataset.TransposeToRows()
	}
	return &dataset.Rows
}
func (dataset *Dataset) GetDataAsColumns() (columns *Columns) {
	if dataset.Mode == DatasetModeRows {
		dataset.TransposeToColumns()
	}
	return &dataset.Columns
}
func (dataset *Dataset) TransposeToColumns() {
	if dataset.GetNRow() <= 0 {
		return
	}
	ncol := dataset.GetNColumn()
	if ncol <= 0 {
		types := dataset.GetRow(0).Types()
		dataset.SetColumnsType(types)
		ncol = len(types)
	}
	orgmode := dataset.GetMode()
	switch orgmode {
	case DatasetModeRows:
	case DatasetModeColumns, DatasetModeMatrix, DatasetNoMode:
		nrow := dataset.Columns[0].Len()
		if nrow > 0 {
			return
		}
	}
	minlen := len(*dataset.GetRow(0))
	if minlen > ncol {
		minlen = ncol
	}
	switch orgmode {
	case DatasetModeRows, DatasetNoMode:
		dataset.SetMode(DatasetModeColumns)
	}
	for _, row := range dataset.Rows {
		for y := 0; y < minlen; y++ {
			dataset.Columns[y].PushBack((*row)[y])
		}
	}
	if orgmode == DatasetModeRows {
		dataset.Rows = nil
	}
}
func (dataset *Dataset) TransposeToRows() {
	orgmode := dataset.GetMode()
	if orgmode == DatasetModeRows {
		return
	}
	if orgmode == DatasetModeColumns {
		dataset.SetMode(DatasetModeRows)
	}
	rowlen := math.MinInt32
	flen := len(dataset.Columns)
	for f := 0; f < flen; f++ {
		l := dataset.Columns[f].Len()
		if l > rowlen {
			rowlen = l
		}
	}
	dataset.Rows = make(Rows, 0)
	for r := 0; r < rowlen; r++ {
		row := make(Row, flen)
		for f := 0; f < flen; f++ {
			if dataset.Columns[f].Len() > r {
				row[f] = dataset.Columns[f].Records[r]
			} else {
				row[f] = NewRecord()
			}
		}
		dataset.Rows = append(dataset.Rows, &row)
	}
	if orgmode == DatasetModeColumns {
		dataset.Columns.Reset()
	}
}
func (dataset *Dataset) PushRow(row *Row) {
	switch dataset.GetMode() {
	case DatasetModeRows:
		dataset.Rows = append(dataset.Rows, row)
	case DatasetModeColumns:
		dataset.PushRowToColumns(row)
	case DatasetModeMatrix, DatasetNoMode:
		dataset.Rows = append(dataset.Rows, row)
		dataset.PushRowToColumns(row)
	}
}
func (dataset *Dataset) PushRowToColumns(row *Row) {
	rowlen := row.Len()
	if rowlen <= 0 {
		return
	}
	collen := len(dataset.Columns)
	if collen <= 0 {
		dataset.Columns = make(Columns, rowlen)
		collen = rowlen
	}
	min := rowlen
	if collen < rowlen {
		min = collen
	}
	for x := 0; x < min; x++ {
		dataset.Columns[x].PushBack((*row)[x])
	}
}