TokenVector.Data 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TokenVector.Data --version 1.0.1
                    
NuGet\Install-Package TokenVector.Data -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TokenVector.Data" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TokenVector.Data" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="TokenVector.Data" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TokenVector.Data --version 1.0.1
                    
#r "nuget: TokenVector.Data, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TokenVector.Data@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TokenVector.Data&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=TokenVector.Data&version=1.0.1
                    
Install as a Cake Tool

TokenVector.Data

πŸ‡¬πŸ‡§ English | πŸ‡»πŸ‡³ TiαΊΏng Việt

Language Target License: MIT Tests

TokenVector.Data is a high-performance columnar DataFrame and tabular data processing library natively implemented in the TokenVector programming language (tkv) and compiled to a .NET CIL assembly (TokenVector.Data.dll) via tkvc + ilasm.

Version 1.0.1 marks the complete migration of the library from C# to the TokenVector language: all 22 C# source files were ported to 6 native .tkv modules, and all 51 unit tests were re-mapped as native tkv checks β€” 51/51 passing.


πŸ“¦ Modules

Module (tkv) Contents
tokenvector_data.tkv DataTypes, Schema, Mask (null bitmap), Col, StrCol, Series, DataFrame, ChunkedArray helpers
tokenvector_compute.tkv VectorMath (add/sub/mul/div, exp, log, abs, scalar ops), FilterEngine, Aggregations (sum/mean/min/max/std/var/quantile), WindowFunctions (rolling, shift, diff, cumsum, rank)
tokenvector_relational.tkv GroupByEngine (multi-key, multi-agg), JoinEngine (Inner/Left/Right/Full/Cross + financial AsOfJoin), ReshapeEngine (Pivot, Melt, Concat vertical/horizontal)
tokenvector_io.tkv FastCsvReader/Writer (quoted fields, schema inference), FastJsonReader (NDJSON streaming + JSON array)
tokenvector_numerics.tkv NumericsInterop β€” Series/DataFrame ⇄ Mat (NDArray/Tensor model) bridge with zero-copy f64 view and requires_grad flag
tokenvector_arrow.tkv ArrowIpcEngine (ARROW1 stream round-trip preserving null masks) + OutOfCoreDataFrame (persist / open / read batch)

✨ Highlights

  • Pure TokenVector implementation β€” no C# sources remain; the whole engine lives in 6 .tkv modules (~116 KB source).
  • Familiar DataFrame API β€” Series/DataFrame with schema, per-column null masks, group-by aggregations, 5 join kinds, AsOf time-series join, pivot/melt.
  • Robust I/O β€” CSV with quotes & type inference, NDJSON and JSON-array readers, writer round-trips, file and string based.
  • Arrow-style interchange β€” ARROW1-framed stream format that survives null masks (validity bitmaps) through serialization.
  • Numerics bridge β€” convert numeric columns to a 1D/2D Mat (flat f64 buffer + shape + requires_grad); f64 columns with no nulls are wrapped zero-copy (mutations through the Mat are visible in the Series).
  • .NET interop β€” compiled to a plain CIL DLL; callable from any .NET language via reflection or direct references to the TKVApp class.

πŸ§ͺ Verification & Quality Assurance

The original C# test suite (51 [Fact]s) has been fully re-mapped to native tkv check programs. Regression status β€” all green:

base_check   (DataTypes/Schema/Mask/Column/StringColumn)   SUCCESS
comp_check   (VectorMath/Filter/Agg/Window)                SUCCESS
core_check   (Series/DataFrame/ChunkedArray)               SUCCESS
rel_check    (GroupBy/Join/AsOf/Pivot/Melt/Concat)         SUCCESS
io_check     (CSV/NDJSON/JSON array/TSV/file IO)           SUCCESS
num_check    (NumericsInterop: 4 checks)                   ALL PASS
arr_check    (ArrowIpc/OutOfCore: 2 checks)                ALL PASS

πŸš€ Quick Start (TokenVector language)

__tkv_import__ = ["tokenvector_data", "tokenvector_relational"]

def run() -> "i32":
    # 1. Create a DataFrame
    df = make_df([
        make_series_i64("user_id", [1, 2, 3, 4, 5]),
        make_series_str("dept", ["IT", "HR", "IT", "Sales", "HR"]),
        make_series_f64("salary", [75000.0, 52000.0, 88000.0, 61000.0, 58000.0]),
    ])

    # 2. GroupBy & aggregation
    report = groupby_agg(df, ["dept"], [
        make_agg("salary", AGG_COUNT, "headcount"),
        make_agg("salary", AGG_MEAN, "avg_salary"),
        make_agg("salary", AGG_MAX, "max_salary"),
    ])

    # 3. Join kinds
    joined = join_frames(df, bonuses, "user_id", "user_id", JOIN_INNER)

    # 4. CSV I/O
    df2 = csv_read_string(csv_text, ",", 1, "")
    out = csv_write_string(df2, ",", 1, "")
    return 0

πŸ’» Quick Start (.NET side via reflection)

$asm  = [System.Reflection.Assembly]::LoadFrom("TokenVector.Data.dll")
$app  = $asm.GetType("TKVApp")

$csv = "id,name,score`n1,Alice,95.5`n2,Bob,88.0"
$df  = $app.GetMethod("csv_read_string").Invoke($null,
         @([string]$csv, [string]",", [int]1, [string]""))
$df.GetType().GetMethod("row_count").Invoke($df, @())   # -> 2

All engine functions are static methods of the TKVApp class (records such as DataFrame, Series, Mask are public classes usable as .NET types).


πŸ”§ Build from source

Requirements: TokenVector compiler (tkvc.exe) and .NET Framework ilasm.exe.

# 1. Merge the 6 modules into one library source (see tvsrc/build scripts)
tkvc.exe build --entry run tokenvector_data_all.tkv   # emits .exe + tokenvector_data_all.il

# 2. Convert IL: rename module/assembly to TokenVector.Data, remove .entrypoint

# 3. Assemble the DLL
ilasm.exe /nologo /quiet /dll /output:TokenVector.Data.dll TokenVector.Data.il

# 4. Package
nuget.exe pack TokenVector.Data.nuspec

Prebuilt artifacts: tvsrc/TokenVector.Data.dll and packages/TokenVector.Data.1.0.1.nupkg.


πŸ“„ License

MIT β€” see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.10 107 9/25/2026
1.0.9 106 9/23/2026
1.0.8-dev 92 9/23/2026
1.0.2 115 9/19/2026
1.0.1 104 9/18/2026
1.0.0 120 9/13/2026

1.0.1: Full migration of the library from C# to the native TokenVector language (tkv). All 22 C# source files ported to 6 tkv modules; all 51 unit tests re-mapped as native tkv checks (51/51 passing). Same DLL surface (TKVApp static methods + record classes).