🎯 czv includes Rust, Python, & WebAssembly (JavaScript/TypeScript) libraries for CSV data engineering and analysis operations written in Rust. 💻 cargo/pip install czv or npm install czv-wasm
Find a file
rzmk ce260e9491 refactor: use czv in czv-python
- Add `file_path` for czv-python count operations
- Refactor tests based on file path instead of data
- Use thiserror in czv
- Update examples to reflect changes
2024-06-20 01:03:54 -04:00
.github feat: add czv, czv-wasm, and czv-python (init release) 2024-06-19 22:55:19 -04:00
czv refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00
czv-python refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00
czv-wasm refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00
.gitignore feat: add czv, czv-wasm, and czv-python (init release) 2024-06-19 22:55:19 -04:00
Cargo.lock refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00
Cargo.toml feat: add czv, czv-wasm, and czv-python (init release) 2024-06-19 22:55:19 -04:00
LICENSE refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00
README.md refactor: use czv in czv-python 2024-06-20 01:03:54 -04:00

czv

czv is CSV content manipulation/analysis libraries with support for Rust, Python, and WebAssembly (JavaScript and TypeScript).

Installation and examples

Rust

cargo install czv
use czv::{
    count::RowCount,
    Result
};

fn main() -> Result<()> {
    let data = "\
fruits,price
apple,2.50
banana,3.00
strawberry,1.50
";
    let output = RowCount::new()
        .file_data(data)
        .execute()?;
    println!("{output}"); // 3
    Ok(())
}

JavaScript/TypeScript (WebAssembly)

bun install czv

Or use npm, pnpm, or yarn instead of bun.

import init, * as czv from "czv";
// Must run `await init()` or `initSync()` first for web use
await init();

const data = `fruits,price
apple,2.50
banana,3.00
strawberry,1.50`;

const output = czv.rowCount(data);
console.log(output);

Python

pip install czv
import czv

data = """fruits,price
apple,2.50
banana,3.00
strawberry,1.50"""

output = czv.row_count(file_data=data)

print(output)

Available operations

czv (Rust) czv-wasm (JS/TS) czv-python Summary
count::RowCount rowCount count.row_count Get the number of rows
count::ColumnCount columnCount count.column_count Get the number of columns

Development

Each package has its own README.md with more info for that particular package.

You may generate docs with:

cargo doc --no-deps --workspace --open

Notes

czv is inspired by the command-line tools xsv and qsv, but czv is not intended to cover all of their commands or features.

Not all provided libraries may be in sync at a given time. See the available operations table for a common operation list between libraries (not all implementations for a given operation may be in sync either, for example they may not have the same builder/function arguments).

Here are a few expected features for each provided operation:

  • czv (Rust)
    • Provide both a builder (recommended and common for conditional parameters) and a function
    • Provide documentation (docstrings) in Markdown format
  • czv-wasm (Web, JavaScript and TypeScript)
    • Use camelCase for exported functions
    • Include common browser support to run in-browser
    • Provide documentation (dosctrings) in TSDoc format
  • czv-python
    • Provide documentation (docstrings) and type hints for IDEs when developers are using the Python library (sourced from czv-python/czv.pyi) in Markdown format