// NewDataFrameFromMem creates a new data frame from the provided in-memory data.
NewDataFrameFromMem creates a new data frame from the provided in-memory data.
// NewDataFrameFromMem creates a new data frame from the provided in - memory data .
func NewDataFrameFromMem(mem memory.Allocator, dict Dict) (*DataFrame, error) {
	var (
		err    error
		arrs   = make([]array.Interface, 0, len(dict))
		fields = make([]arrow.Field, 0, len(dict))
	)
	keys := make([]string, 0, len(dict))
	for k := range dict {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for _, k := range keys {
		v := dict[k]
		arr, field, newInterfaceErr := constructors.NewInterfaceFromMem(mem, k, v, nil)
		if newInterfaceErr != nil {
			err = newInterfaceErr
			break
		}
		arrs = append(arrs, arr)
		fields = append(fields, *field)
	}
	defer func() {
		for i := range arrs {
			arrs[i].Release()
		}
	}()
	if err != nil {
		return nil, err
	}
	schema := arrow.NewSchema(fields, nil)
	return NewDataFrame(mem, schema, arrs)
}
func NewDataFrameFromMem ( mem memory . Allocator , dict Dict ) ( * DataFrame , error ) { var ( err error arrs = make ( [ ] array . Interface , 0 , len ( dict ) ) fields = make ( [ ] arrow . Field , 0 , len ( dict ) ) ) keys := make ( [ ] string , 0 , len ( dict ) ) for k := range dict { keys = append ( keys , k ) } sort . Strings ( keys ) for _ , k := range keys { v := dict [ k ] arr , field , newInterfaceErr := constructors . NewInterfaceFromMem ( mem , k , v , nil ) if newInterfaceErr != nil { err = newInterfaceErr break } arrs = append ( arrs , arr ) fields = append ( fields , * field ) } defer func ( ) { for i := range arrs { arrs [ i ] . Release ( ) } } ( ) if err != nil { return nil , err } schema := arrow . NewSchema ( fields , nil ) return NewDataFrame ( mem , schema , arrs ) }
NewDataFrameFromMem creates a new data frame from the provided in-memory data.
NewDataFrameFromMem creates a new data frame from the provided in - memory data .