Polars.NET.Core 0.1.0-alpha2

This is a prerelease version of Polars.NET.Core.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Polars.NET.Core --version 0.1.0-alpha2
                    
NuGet\Install-Package Polars.NET.Core -Version 0.1.0-alpha2
                    
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="Polars.NET.Core" Version="0.1.0-alpha2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Polars.NET.Core" Version="0.1.0-alpha2" />
                    
Directory.Packages.props
<PackageReference Include="Polars.NET.Core" />
                    
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 Polars.NET.Core --version 0.1.0-alpha2
                    
#r "nuget: Polars.NET.Core, 0.1.0-alpha2"
                    
#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 Polars.NET.Core@0.1.0-alpha2
                    
#: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=Polars.NET.Core&version=0.1.0-alpha2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Polars.NET.Core&version=0.1.0-alpha2&prerelease
                    
Install as a Cake Tool

NuGet NuGet Downloads NuGet NuGet Downloads

Polars.NET

πŸš€ High-Performance, AI-Ready DataFrames for .NET, powered by Rust & Apache Arrow.

Polars.NET is not just a binding; it is a production-grade data engineering toolkit for the .NET ecosystem. It brings the lightning-fast performance of the Polars Rust engine to C# and F#, while adding unique, enterprise-ready features missing from official bindingsβ€”like seamless Database Streaming, Zero-Copy Interop, and AI-native Vector support.

Why Polars.NET exists

The .NET ecosystem deserves a first-class, production-grade DataFrame engine β€” not a thin wrapper, not a toy binding, and not a Python dependency in disguise.

Polars.NET is designed for engineers who care about:

  • predictable performance

  • strong typing

  • streaming data at scale

  • and long-term system evolution

Why Polars.NET?

  1. ⚑ Unmatched Performance
  • Rust Core: Built on the blazing fast Polars query engine (written in Rust).

  • Lazy Evaluation: Intelligent query optimizer with predicate pushdown, projection pushdown, and parallel execution.

  • Zero-Copy: Built on Apache Arrow, enabling zero-copy data transfer between C#, Python, and databases.

  1. πŸ›‘οΈ Enterprise & AI Ready
  • Database Streaming (Unique):

    • Read: Stream millions of rows from any IDataReader (SQL Server, Postgres, SQLite) directly into Polars without loading everything into RAM.

    • Write: Stream processed data back to databases via IBulkCopy interfaces using our unique ArrowToDbStream adapter.

  1. 🧢 .NET Native Experience

    • Fluent API: Intuitive, LINQ-like API design for C#.

    • Functional API: Idiomatic, pipe-forward (|>) API for F# lovers.

    • Type Safety: Leveraging .NET's strong type system to prevent runtime errors.

    • Feel free to use C#/F# native UDF to integrate with your own logic.

πŸ“¦ Installation

C# Users:

dotnet add package Polars.NET

F# Users:

dotnet add package Polars.FSharp

πŸ—œ Target Framework

.NET 8 and later

🏁 Quick Start

C# Example

using Polars.CSharp;
using static Polars.CSharp.Polars; // For Col(), Lit() helpers

// 1. Create a DataFrame
var data = new[] {
    new { Name = "Alice", Age = 25, Dept = "IT" },
    new { Name = "Bob", Age = 30, Dept = "HR" },
    new { Name = "Charlie", Age = 35, Dept = "IT" }
};
using var df = DataFrame.From(data);

// 2. Filter & Aggregate
using var res = df
    .Filter(Col("Age") > 28)
    .GroupBy("Dept")
    .Agg(
        Col("Age").Mean().Alias("AvgAge"),
        Col("Name").Count().Alias("Count")
    )
    .Sort("AvgAge", descending: true);

// 3. Output
res.Show();

F# Example


open Polars.FSharp

// 1. Scan CSV (Lazy)
let lf = LazyFrame.ScanCsv "users.csv"

// 2. Transform Pipeline
let res = 
    lf
    |> pl.filterLazy (pl.col "age" .> pl.lit 28)
    |> pl.groupByLazy 
        [ pl.col "dept" ]
        [ 
            pl.col("age").Mean().Alias "AvgAge" 
            pl.col("name").Count().Alias "Count"
        ]
    |> pl.collect
    |> pl.sort ("AvgAge", false)

// 3. Output
res.Show()

πŸ”₯ Killer Features (The "Missing" Parts)

  1. 🌊 Streaming ETL: Database β†’ Polars β†’ Database

Process millions of rows with constant memory usage using our unique streaming adapters.

// 1. Source: Stream from Database (e.g., SqlDataReader)
// We scan the DB via a factory, pulling 50k rows at a time into Apache Arrow batches.
var lf = LazyFrame.ScanDb(() => mySqlCommand.ExecuteReader(), batchSize: 50_000);

// 2. Transform: Lazy Evaluation (Rust Engine)
// No data is loaded yet. We are building a query plan.
var pipeline = lf
    .Filter(Col("Region") == Lit("US"))
    .WithColumn((Col("Amount") * 1.08).Alias("TaxedAmount"))
    .Select("OrderId", "TaxedAmount", "OrderDate");

// 3. Sink: Stream back to Database (e.g., SqlBulkCopy)
// We expose the processed stream as an IDataReader implementation!
pipeline.SinkTo((IDataReader reader) => 
{
    // This reader pulls data from the Rust engine on-demand.
    // Perfect for SqlBulkCopy.WriteToServer(reader)
    using var bulk = new SqlBulkCopy(connectionString);
    bulk.DestinationTableName = "ProcessedOrders";
    bulk.WriteToServer(reader);
});
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     Arrow Batches     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Database    β”‚ ───────────────────▢ β”‚ Polars Coreβ”‚
β”‚ (IDataReader)β”‚                       β”‚   (Rust)   β”‚
β””β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ◀─────────────────── β”‚            β”‚
      β”‚        Zero-Copy Stream        β””β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                      β”‚
      β”‚                                      β”‚ FFI
β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”                               β”‚
β”‚   .NET API β”‚ β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ (C# / F#)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. 🧠 Native C#/F# UDFs

Run C#/F# functions directly on Expr/Series with Zero-Copy overhead using Apache Arrow memory layout.

// Define logic with Option handling (Safe!)
let complexLogic (opt: int option) =
    match opt with
    | Some x when x % 2 = 0 -> Some (x * 10)
    | _ -> None

let s = Series.create("nums", [Some 1; Some 2; None; Some 4])

// Execute MapOption directly on Series
// No need to convert to C# objects or slow IEnumerable!
let result = s.MapOption(complexLogic, DataType.Int32)

// Result: [null, 20, null, 40]
  1. πŸ•’ Time Series Intelligence

Robust support for time-series data, including As-Of Joins and Dynamic Rolling Windows.

// As-Of Join: Match trades to the nearest quote within 2 seconds
var trades = dfTrades.Lazy(); // timestamp, ticker, price
var quotes = dfQuotes.Lazy(); // timestamp, ticker, bid

var enriched = trades.JoinAsOf(
    quotes, 
    leftOn: Col("timestamp"), 
    rightOn: Col("timestamp"),
    by: [Col("ticker")],      // Match on same Ticker
    tolerance: "2s",          // Look back max 2 seconds
    strategy: "backward"      // Find previous quote
);
// F# Dynamic Rolling Window
lf
|> pl.groupByDynamic "time" (TimeSpan.FromHours 1.0)
    [ pl.col("value").Mean().Alias("hourly_mean") ]
|> pl.collect

πŸ—ΊοΈ Roadmap & Documentation

We are actively working on detailed API documentation.

- Auto-generated API Reference (HTML)

And plan to migrate core Polars Engine from 0.50 to 0.52(newest)

🀝 Contributing

Contributions are welcome! Whether it's adding new expression mappings, improving documentation, or optimizing the FFI layer.

  1. Fork the repo.

  2. Create your feature branch.

  3. Submit a Pull Request.

πŸ“„ License

MIT License. See LICENSE for details.

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 is compatible.  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 is compatible.  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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Polars.NET.Core:

Package Downloads
Polars.NET

Idiomatic C# API Frontend for Polars DataFrame library.

Polars.FSharp

Idiomatic F# API for Polars DataFrame library with strict type safety and pipeline support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.1 144 2/28/2026
0.3.0 228 2/26/2026
0.2.1-beta1 292 2/6/2026
0.2.0-beta1 194 2/4/2026
0.1.0-beta1 127 1/14/2026
0.1.0-alpha2 117 1/10/2026
0.1.0-alpha1 123 1/4/2026