Repository navigation
Releases
v0.2.0
Added
- Swift Package Index (
.spi.yml) configuration for hosted DocC documentation (documentation_targets: [Bandal]). - Multi-platform deployment support in
Package.swift(.macOS(.v14),.iOS(.v17),.tvOS(.v17),.visionOS(.v1)). - Comprehensive DocC documentation comments (
///,- Parameters:,- Returns:,- Throws:) across allBandal,BandalBenchmarks, andBandalPandasBenchmarksource files, plus 8 DocC articles and complete symbol curation inSources/Bandal/Bandal.docc/. Scripts/benchmark.sh: pandas vs Bandal (native Swift, MLX CPU, MLX GPU) comparison that provisions auvenvironment, builds theBandalPandasBenchmarktarget (Sources/BandalPandasBenchmark/main.swift), and prints computation-only timings with checksum verification.
Performance
rolling/expandingsum,mean,countuse a native single-pass O(n) kernel (Neumaier-compensated for sliding windows) instead of MLX prefix sums, now 2.6x (rolling) and 5x (expanding) faster than pandas on 1M–5M rows in all execution policies.- Element-wise
+,-,*,/andsqrtuse a single-pass SIMD kernel that folds the finite check into the write loop, and the native-policy fallback shares it;sqrt/signno longer use the GPUFloat32path.arithmetic_sqrtis now ≥ 1.05x vs pandas in all policies.
v0.1.3
Bandal v0.1.3 — Faster than pandas across the benchmark suite
v0.1.3 is a performance release. Every workload in the pandas comparison benchmark now runs at or above pandas speed under all four execution policies (native, cpu, gpu, gpuFloat32). Checksums still match pandas (match: ok). There are no public API changes.
Performance (5,000,000 rows, speedup vs pandas)
| Workload | v0.1.3 |
|---|---|
left_join |
~130x |
groupby_sum |
~30x |
sort |
~6.3x |
correlation |
~6x (native/CPU), 4.4x (GPU) |
filter |
~6x |
expanding(.sum) |
~5x |
rolling(.mean, window: 20) |
~2.7x |
summary() |
1.5x (CPU) – 3.3x (GPU) |
arithmetic + sqrt |
~1.1x |
Median computation time only, pandas 3.1.1 vs Bandal. Reproduce with Scripts/benchmark.sh --rows 100000,1000000,5000000.
Highlights
- Rolling and expanding windows:
sum,meanandcountnow use a native single-pass O(n) kernel with Neumaier-compensated summation. They no longer go through MLX prefix sums, which were about 0.5x of pandas under the MLX policies. - Element-wise arithmetic and
sqrt:+ - * /andsqrtuse a single-pass SIMD kernel that checks the result is finite as part of the write loop, with no separate validation pass. The native-policy fallback shares the same kernel. - GPU
Float32path:sqrtandsignno longer use it, because theDouble↔Floatconversion costs more than the GPU saves. - Columnar engine (Phase 8): unboxed typed paths for group-by, joins, sorting, filtering and
BitSetslicing, plus O(N) sliding-window kernels.
Quality
- 69 tests pass with
swift testandScripts/test-with-mlx.sh. - New tests cover sliding and expanding windows with missing values across execution policies, sliding-sum accuracy after a large value leaves the window, and chained multiply → add →
sqrtwith negative inputs.
Upgrade
.package(url: "https://github.com/NeuroAssociates/Bandal.git", from: "0.1.3")v0.1.2
Highlights
0.1.2 removes [DataValue] boxing between columnar storage and MLX, and adds a large set of pandas-style APIs. Every public declaration is now documented, and Bandal ships a DocC catalog.
Added
- Vectorized boolean indexing:
BooleanMask(&&,||,!),Seriescomparison operators (<,<=,>,>=,equals(_:),notEquals(_:)),df[mask]andfiltered(by:). - Math and scaling:
UnaryMathFunctionwithapplying(_:)andpower(_:)(MLX-accelerated),standardized,minMaxScaled. - Binning, interpolation and conditional replacement:
binned(pd.cut),quantileBinned(pd.qcut),interpolated,where(_:otherwise:),indexOfMax()/indexOfMin(). - Windows:
exponentiallyWeighted/exponentiallyWeightedMean(ewm) andminPeriodsforrolling. - Reshaping, grouping and joins:
pivoted,crossTabulated,oneHotEncoded,GroupedDataFrame.filter(_:), aggregation aliases (as:),pipe(_:),joinAsOf(merge_asof),resample. - Structured results:
SeriesDescription(describeStructured()) andQuantileTable(quantiles(_:)). - Execution policy:
ExecutionPolicy.gpuFloat32, which runs general finite floating-point workloads inFloat32on the Metal GPU. - Documentation:
///comments on all public declarations, a DocC catalog and.spi.ymlfor Swift Package Index, and a "Project structure" section inCONTRIBUTING.md.
Performance
Float64Column/Int64Columnshare numeric buffers and feed MLX kernels directly, with no[DataValue]round-trips.Seriesis backed by a typed column, and unchanged columns are reused in O(1) bywithColumn,select,dropand similar operations.- Fused
MLX.evalcalls for moments and cumulative operations. - Strided MLX rolling windows for sum, mean, min, max, variance and standard deviation.
- Columnar
querymasks and multi-keygroupByusing denseInt32group IDs. - CSV fields are parsed straight into typed column builders.
Changed
CheckPoints.mdandToDo.mdmoved toDocumentation/Development/;AGENTS.mdstays at the root.- Simplified
.gitignore.Package.resolvedis no longer tracked. - English and Korean docs (
API,README) updated.
Compatibility
- No breaking changes to the public API. Requires macOS 14+ and Swift 6.4+.
- All 66 tests pass.
Installation
.package(url: "https://github.com/NeuroAssociates/Bandal.git", from: "0.1.2")v0.1.1
v0.1.1: High-Performance Columnar Engine (Apache Arrow/Polars model)
Introduce a typed columnar storage architecture inspired by Apache Arrow and Polars to eliminate cell-level DataValue boxing, reduce dictionary allocations, and dramatically accelerate core DataFrame operations.
Highlights:
- Typed Columnar Storage: Added BitSet, AnyColumn protocol, and specialized columnar buffers (Float64Column, Int64Column, StringColumn, CategoricalColumn, BooleanColumn, DateColumn, AnyValueColumn) with zero-copy slicing.
- 64-bit Word Bitmap (BitSet): Zero-overhead null tracking and fast boolean mask evaluation with hardware popcount.
- High-Performance Joins: Replaced per-row dictionary construction with integer index gathering and slice(atOptional:) columnar slicing (~3x faster left joins: 19.59ms -> 6.95ms on 40,000 rows).
- Vectorized GroupBy: Single-pass dense Int32 group ID assignment and scatter aggregation directly into contiguous accumulation buffers (43% faster: 12.01ms -> 6.79ms).
- Direct Primitive Sorting: Fast paths for Double, categorical code ranks, timestamps, and strings directly sorting raw index buffers.
- Streamlined CSV Parser: File size-based capacity pre-allocation, quote-free line splitting, UTF-8 BOM auto-detection, and zero-allocation Substring-based numeric parsing (130ms -> 84.39ms).
- 100% Backward Compatibility: All 63 existing unit tests pass with zero compiler warnings."
v0.1.0
Bandal v0.1.0 — First Release
Bandal is a Swift package for tabular data analysis, inspired by pandas and designed with Swift API conventions. This first release provides an immutable, value-oriented API for working with data frames, series, and rows.
Highlights
Create, inspect, filter, sort, and transform DataFrame, Series, and DataRow values.
Read and write CSV with a streaming RFC 4180 implementation, and read and write JSON.
Query data with composable predicates or expression strings; add computed columns and work with missing values.
Group, aggregate, and transform data; join tables; reshape and transpose data; and use rolling and expanding windows.
Calculate descriptive statistics, quantiles, ranks, correlations, and covariances.
Use MLX Swift to accelerate numeric operations, with automatic native Swift fallback when acceleration is unavailable or unnecessary.
Print pandas-style summaries and render tables as Markdown.
Requirements
macOS 14 or later
Swift 6.4 or later
Apple silicon recommended for MLX acceleration
--
Bandal v0.1.0 — 첫 번째 릴리스
Bandal은 pandas에서 영감을 받아 Swift API 설계 원칙에 따라 만든 테이블형 데이터 분석용 Swift 패키지입니다. 이번 첫 릴리스에서는 데이터 프레임, 시리즈, 행을 불변 값 타입 중심의 API로 다룰 수 있습니다.
주요 기능
DataFrame, Series, DataRow 생성 및 조회, 필터링, 정렬, 변환
RFC 4180 기반 스트리밍 CSV 입출력 및 JSON 입출력
조합 가능한 조건식 또는 문자열 표현식으로 데이터 쿼리, 계산 컬럼 추가, 결측값 처리
그룹화·집계·변환, 테이블 조인, 데이터 재구조화·전치, 롤링 및 확장 윈도우
기술 통계, 분위수, 순위, 상관계수 및 공분산 계산
MLX Swift 기반 수치 연산 가속 및, 가속을 사용할 수 없거나 불필요한 경우 네이티브 Swift로 자동 폴백
pandas 스타일 요약 출력 및 Markdown 표 렌더링
요구 사항
macOS 14 이상
Swift 6.4 이상
MLX 가속을 위해 Apple Silicon 권장