Code Monkey home page Code Monkey logo

baskerville's Introduction


Crates.io docs.rs GitHub

Infer and validate data-type schemas in Rust and Python.

RustPython

Installation

cargo add baskerville

Example

# mascots.csv
Name,LOC,Species
Ferris,42,Crab
Corro,7,Urchin
use baskerville::{infer_csv_with_options, CsvInput, InferOptions};

fn main() {
    let fields = infer_csv_with_options(
        CsvInput::Path("mascots.csv"),
        &mut InferOptions {
            has_headers: true,
            ..InferOptions::default()
        },
    )
    .unwrap();
    println!("{fields}");
}

Output:

╭──────┬─────────┬─────────╮
│ Name │ LOC     │ Species │
├──────┼─────────┼─────────┤
│ Text │ Integer │ Text    │
│      │ Float   │         │
│      │ Text    │         │
╰──────┴─────────┴─────────╯

Contributing

Versioning

The repo bases versioning from Conventional Commits

baskerville's People

Contributors

github-actions[bot] avatar jaynewey avatar

Watchers

 avatar

Forkers

szabgab

baskerville's Issues

RegEx validator

Example usage:

let mut validator = RegEx::new("[a-z]");
assert!(validator.validate("a"));
assert!(!validator.validate("0"));

Literal Validator

Recognise when a column has a limited set of values. For example, if we only see "Ferris" and "Corro" in a column for a file with many records, then perhaps that field should be described as Literal["Ferris", "Corro"]. We should pick this up by default. I think a default of up to 10 literal values is sensible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.