Documentation
ยถ
Overview ยถ
Package enchanter is a data-wrangling library for Go, in the spirit of pandas and Polars in Python and dplyr in R.
The entry point is a Context (see NewContext), which carries the string interning pool and the Apache Arrow memory allocator shared by every series and dataframe created from it:
ctx := enchanter.NewContext()
df := dataframe.ReadCsv(ctx).
SetReader(r).Read().
GroupBy("department").
Agg(dataframe.Mean("salary")).
Run()
The functionality lives in the subpackages:
- series: typed, nullable columns (Bool, Int, Int64, Float64, String, Time, Duration) with filtering, grouping, sorting and arithmetic.
- dataframe: the DataFrame type โ select, filter, group by, join, sort, aggregate โ plus Apache Arrow record conversion.
- io: readers and writers for CSV, XLSX, XPT (SAS), JSON, HTML, Markdown, Parquet and Arrow IPC, plus a read-only SAS7BDAT reader.
- arrowutil: conversion helpers between enchanter null masks and Arrow validity bitmaps.
- meta: the type system shared by the packages above.
Index ยถ
- Constants
- type Context
- func (ctx *Context) GetDateTimeFormat() string
- func (ctx *Context) GetEol() string
- func (ctx *Context) GetNaText() string
- func (ctx *Context) GetQuote() string
- func (ctx *Context) GetThreadsNumber() int
- func (ctx *Context) SetDateTimeFormat(s string) *Context
- func (ctx *Context) SetEol(s string) *Context
- func (ctx *Context) SetNaText(s string) *Context
- func (ctx *Context) SetQuote(s string) *Context
- func (ctx *Context) SetThreadsNumber(n int) *Context
- type MapFunc
- type MapFuncNull
- type NullableBool
- type NullableDuration
- type NullableFloat32
- type NullableFloat64
- type NullableInt
- type NullableInt8
- type NullableInt16
- type NullableInt32
- type NullableInt64
- type NullableString
- type NullableTime
- type SeriesSortOrder
- type StringPool
Constants ยถ
const ( // The default capacity of a series. DEFAULT_SERIES_INITIAL_CAPACITY = 10 // The default capacity of a hash map. DEFAULT_HASH_MAP_INITIAL_CAPACITY = 1024 // The default capacity of a dense map array. DEFAULT_DENSE_MAP_ARRAY_INITIAL_CAPACITY = 64 // Number of threads to use for parallel operations. THREADS_NUMBER = 16 // Minimum number of elements to use parallel operations. MINIMUM_PARALLEL_SIZE_1 = 16_384 MINIMUM_PARALLEL_SIZE_2 = 131_072 HASH_MAGIC_NUMBER = int64(0xa8f4979b77e3f93) HASH_MAGIC_NUMBER_NULL = int64(0x7fff4979b77e3f93) HASH_NULL_KEY = int64(0x7ff8000000000001) INF_TEXT = "Inf" NA_TEXT = "Na" EOL = "\n" QUOTE = "\"" BOOL_TRUE_TEXT = "true" BOOL_FALSE_TEXT = "false" DATE_FORMAT = "2006-01-02" DATE_TIME_FORMAT = "2006-01-02 15:04:05" CSV_READER_DEFAULT_DELIMITER = ',' CSV_READER_DEFAULT_HEADER = true CSV_READER_DEFAULT_GUESS_DATA_TYPE_LEN = 1000 XLSX_READER_DEFAULT_GUESS_DATA_TYPE_LEN = 1000 )
Variables ยถ
This section is empty.
Functions ยถ
This section is empty.
Types ยถ
type Context ยถ
type Context struct {
// StringPool is a pool of strings that are used by the series.
// This is used to reduce the number of allocations and to allow for fast comparisons.
StringPool *StringPool
// Allocator is the Arrow memory allocator used for building Arrow arrays.
// Defaults to memory.DefaultAllocator (backed by Go GC, no manual Retain/Release needed).
// Custom allocators must also be GC-backed (e.g. a CheckedAllocator wrapping a
// GoAllocator): the library releases its internal Arrow references
// deterministically, but Release on values returned to callers
// (Series.ArrowArray, DataFrame.ToArrowRecord) is optional.
Allocator memory.Allocator
// contains filtered or unexported fields
}
func NewContext ยถ
func NewContext() *Context
func (*Context) GetDateTimeFormat ยถ
func (*Context) GetThreadsNumber ยถ
func (*Context) SetDateTimeFormat ยถ
func (*Context) SetThreadsNumber ยถ
type NullableBool ยถ
type NullableDuration ยถ
type NullableFloat32 ยถ
type NullableFloat64 ยถ
type NullableInt ยถ
type NullableInt8 ยถ
type NullableInt16 ยถ
type NullableInt32 ยถ
type NullableInt64 ยถ
type NullableString ยถ
type NullableTime ยถ
type SeriesSortOrder ยถ
type SeriesSortOrder int16
const ( // The series is not sorted. SORTED_NONE SeriesSortOrder = iota // The series is sorted in ascending order. SORTED_ASC // The series is sorted in descending order. SORTED_DESC )
type StringPool ยถ
StringPool is a pool of strings that are used by the series. This is used to reduce the number of allocations and to allow for fast comparisons.
func NewStringPool ยถ
func NewStringPool() *StringPool
func (*StringPool) Get ยถ
func (sp *StringPool) Get(s string) *string
Get returns the address of the string if it exists in the pool, otherwise nil.
func (*StringPool) Len ยถ
func (sp *StringPool) Len() int
func (*StringPool) Put ยถ
func (sp *StringPool) Put(s string) *string
Put returns the address of the string if it exists in the pool, otherwise it adds it to the pool and returns its address.
func (*StringPool) PutSync ยถ
func (sp *StringPool) PutSync(s string) *string
PutSync returns the address of the string if it exists in the pool, otherwise it adds it to the pool and returns its address. This version is thread-safe.
func (*StringPool) SetNaText ยถ
func (sp *StringPool) SetNaText(s string) *StringPool
func (*StringPool) ToString ยถ
func (sp *StringPool) ToString() string
Directories
ยถ
| Path | Synopsis |
|---|---|
|
Package arrowutil provides conversion utilities between enchanter's null mask convention (bit-set=null) and Arrow's validity bitmap convention (bit-set=valid).
|
Package arrowutil provides conversion utilities between enchanter's null mask convention (bit-set=null) and Arrow's validity bitmap convention (bit-set=valid). |
|
Package dataframe implements the DataFrame: an ordered collection of named, equally sized series with relational-style operations.
|
Package dataframe implements the DataFrame: an ordered collection of named, equally sized series with relational-style operations. |
|
Package io implements the file readers and writers behind the dataframe I/O chains: CSV, XLSX, XPT (SAS transport, versions 5-9), JSON, HTML, Markdown, Parquet, Arrow IPC (Feather) and SAS7BDAT (read-only, via kshedden/datareader).
|
Package io implements the file readers and writers behind the dataframe I/O chains: CSV, XLSX, XPT (SAS transport, versions 5-9), JSON, HTML, Markdown, Parquet, Arrow IPC (Feather) and SAS7BDAT (read-only, via kshedden/datareader). |
|
Package meta defines the type system shared across enchanter: the BaseType enumeration for series element types, type cardinality, and the operation metadata used by the code generator.
|
Package meta defines the type system shared across enchanter: the BaseType enumeration for series element types, type cardinality, and the operation metadata used by the code generator. |
|
Package series implements typed, nullable columns โ the building block of dataframes.
|
Package series implements typed, nullable columns โ the building block of dataframes. |