// SetColTypes sets the types of the columns of the DataFrame to the given types
SetColTypes sets the types of the columns of the DataFrame to the given types
// SetColTypes sets the types of the columns of the DataFrame to the given types
func (df *DF) SetColTypes(types ...ColType) error {
	if len(types) == 0 {
		err := ErrNoTypesGiven
		df.addError(err)
		return err
	}
	for i, colType := range types {
		if colType < ColTypeUnknown || colType >= ColTypeMaxVal {
			err := dfErrorf("bad column type: column: %d type: %q", i, colType)
			df.addError(err)
			return err
		}
	}
	if len(df.mci.info) == 0 {
		df.mci.info = make([]ColInfo, len(types))
	}
	if len(df.mci.info) != len(types) {
		err := dfErrorf(
			"the number of columns (%d) and number of types (%d) differ",
			len(df.mci.info), len(types))
		df.addError(err)
		return err
	}
	for i, colType := range types {
		df.mci.info[i].colType = colType
		df.setIdx(i)
	}
	return nil
}
func ( df * DF ) SetColTypes ( types ... ColType ) error { if len ( types ) == 0 { err := ErrNoTypesGiven df . addError ( err ) return err } for i , colType := range types { if colType < ColTypeUnknown || colType >= ColTypeMaxVal { err := dfErrorf ( " " , i , colType ) df . addError ( err ) return err } } if len ( df . mci . info ) == 0 { df . mci . info = make ( [ ] ColInfo , len ( types ) ) } if len ( df . mci . info ) != len ( types ) { err := dfErrorf ( " " , len ( df . mci . info ) , len ( types ) ) df . addError ( err ) return err } for i , colType := range types { df . mci . info [ i ] . colType = colType df . setIdx ( i ) } return nil }
SetColTypes sets the types of the columns of the DataFrame to the given types
SetColTypes sets the types of the columns of the DataFrame to the given types