// AddRowFromText will add a new row to the DataFrame
AddRowFromText will add a new row to the DataFrame
// AddRowFromText will add a new row to the DataFrame
func (df *DF) AddRowFromText(cols []string) {
	if len(cols) != len(df.mci.info) {
		df.addError(dfErrorf("dataframe has %d columns, %d are being added",
			len(df.mci.info), len(cols)))
		return
	}
	for i, c := range df.mci.info {
		valIdx := df.mci.valIdx[i]
		var err error
		switch c.colType {
		case ColTypeBool:
			var v BoolVal
			err = v.SetVal(cols[i])
			df.boolCols[valIdx] = append(df.boolCols[valIdx], v)
		case ColTypeInt:
			var v IntVal
			err = v.SetVal(cols[i])
			df.intCols[valIdx] = append(df.intCols[valIdx], v)
		case ColTypeFloat:
			var v FloatVal
			err = v.SetVal(cols[i])
			df.floatCols[valIdx] = append(df.floatCols[valIdx], v)
		case ColTypeString:
			v := StringVal{Val: cols[i]}
			df.stringCols[valIdx] = append(df.stringCols[valIdx], v)
		default:
			panic(dfErrorf("Unexpected column type: %q", c.colType))
		}
		if err != nil {
			df.addError(dfErrorf("data row: %d column: %d: %s",
				df.RowCount(), i, err))
		}
	}
}
func ( df * DF ) AddRowFromText ( cols [ ] string ) { if len ( cols ) != len ( df . mci . info ) { df . addError ( dfErrorf ( " " , len ( df . mci . info ) , len ( cols ) ) ) return } for i , c := range df . mci . info { valIdx := df . mci . valIdx [ i ] var err error switch c . colType { case ColTypeBool : var v BoolVal err = v . SetVal ( cols [ i ] ) df . boolCols [ valIdx ] = append ( df . boolCols [ valIdx ] , v ) case ColTypeInt : var v IntVal err = v . SetVal ( cols [ i ] ) df . intCols [ valIdx ] = append ( df . intCols [ valIdx ] , v ) case ColTypeFloat : var v FloatVal err = v . SetVal ( cols [ i ] ) df . floatCols [ valIdx ] = append ( df . floatCols [ valIdx ] , v ) case ColTypeString : v := StringVal { Val : cols [ i ] } df . stringCols [ valIdx ] = append ( df . stringCols [ valIdx ] , v ) default : panic ( dfErrorf ( " " , c . colType ) ) } if err != nil { df . addError ( dfErrorf ( " " , df . RowCount ( ) , i , err ) ) } } }
AddRowFromText will add a new row to the DataFrame
AddRowFromText will add a new row to the DataFrame