{"id":13822539,"url":"https://github.com/milesgranger/black-jack","last_synced_at":"2025-05-16T17:31:06.496Z","repository":{"id":48511478,"uuid":"145226906","full_name":"milesgranger/black-jack","owner":"milesgranger","description":"DataFrame / Series data processing in Rust","archived":true,"fork":false,"pushed_at":"2022-12-28T04:22:08.000Z","size":314,"stargazers_count":29,"open_issues_count":18,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-31T11:53:47.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milesgranger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-18T14:31:48.000Z","updated_at":"2024-06-06T08:43:21.000Z","dependencies_parsed_at":"2023-01-31T05:45:35.612Z","dependency_job_id":null,"html_url":"https://github.com/milesgranger/black-jack","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fblack-jack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fblack-jack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fblack-jack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fblack-jack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milesgranger","download_url":"https://codeload.github.com/milesgranger/black-jack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225442783,"owners_count":17475110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T08:02:05.182Z","updated_at":"2024-11-19T23:30:35.151Z","avatar_url":"https://github.com/milesgranger.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# black-jack\n\n##### While PRs are welcome, the approach taken only allows for concrete types (String, f64, i64, ...) I'm not sure this is the way to go. I want to think that using anything which implements `serde::{Serialize, Deserialize}` and better use of traits may have more flexibility, just not sure how to do that yet. The project is not abandoned, just in limbo. :-)\n\n[![crates.io](http://meritbadge.herokuapp.com/black-jack)](https://crates.io/crates/black-jack) \n[![Build Status](https://travis-ci.com/milesgranger/black-jack.svg?branch=master)](https://travis-ci.com/milesgranger/black-jack) \n[![Coverage Status](https://coveralls.io/repos/github/milesgranger/black-jack/badge.svg?branch=master)](https://coveralls.io/github/milesgranger/black-jack?branch=master)\n[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\u0026repo=milesgranger/black-jack)](https://dependabot.com)\n\n\n\n[Rust API Documentation](https://docs.rs/black-jack)\n\n---\n\nBlackJack strives to be a full featured crate for general data processing.\n\n\n_Long term_ goal is to create a lightweight [Pandas](https://pandas.pydata.org/) equivalent\nby and for the Rust community, but with slight differences in focus...\n\n\nThe project strives for a few key principles. When any implementation decisions are to be made,\nthey are made with these principles in mind, and in this order:\n1. **Memory efficiency**\n    - Minimize memory use at every opportunity.\n2. **Usability**\n    - Strive for ergonomics; often done by modeling the `Pandas` API where possible.\n3. **Speedy**\n    - It comes naturally most times with Rust. :)\n\n\nEventually we'll have a Python wrapper: [Lumber-Jack](https://github.com/milesgranger/lumber-jack)\nassociated with this crate, but that time will come.\n\n### Example use:\n\n```rust,skt-default\n\n// We have a dataframe, of course...\nlet mut df = DataFrame::new();\n\n// Make some series, of different types\nlet series_i32: Series\u003ci32\u003e = Series::arange(0, 5);\nlet mut series_f64: Series\u003cf64\u003e = Series::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0]);\n\n// You can set a series name!\nseries_f64.set_name(\"my-series\");\n\n// Or not... \nassert_eq!(series_i32.name(), None);\n\n// And add them to the dataframe\ndf.add_column(series_f64).unwrap();\ndf.add_column(series_i32).unwrap();\n\n// And then get a reference to a Series\nlet series_f64_ref: \u0026Series\u003cf64\u003e = df.get_column(\"my-series\").unwrap();\n\n```\n\n## Read a CSV file:\nAlso supports reading `.gz` files\n\n```rust,skt-default\n\n// Define the path to file\nlet path: \u0026str = concat!(env!(\"CARGO_MANIFEST_DIR\"), \"/tests/data/medium_csv.csv\");\n\n// Use the `Reader` to read the dataframe\nlet df = Reader::new(\u0026path).read().expect(\"Failed to read file\");\n\n// Get a refrence to a specific column and assert the sum of that series\nlet series2: \u0026Series\u003ci32\u003e = df.get_column(\"col2\").unwrap();\n\nassert_eq!(series2.sum(), 3000);\n\n```\n\n## Query/filter a dataframe\n\n```rust,skt-default\nlet mut s1 = Series::from(0..5);\ns1.set_name(\"col1\");\n\nlet mut s2 = Series::from(10..15);\ns2.set_name(\"col2\");\n\nlet mut s3 = Series::from_vec(vec![\n    \"foo\".to_string(),\n    \"bar\".to_string(),\n    \"foo\".to_string(),\n    \"bar\".to_string(),\n    \"foo\".to_string(),\n]);\ns3.set_name(\"col3\");\n\nlet mut df = DataFrame::new();\nassert!(df.add_column(s1).is_ok());\nassert!(df.add_column(s2).is_ok());\nassert!(df.add_column(s3).is_ok());\n\n// Before filtering, we're len 5 and first element of 'col1' is 0\nassert_eq!(df.len(), 5);\n\ndf.filter_by_row(|row| row[\"col1\"] == Datum::I32(\u00260));\n\n// After filtering, we're len 4 and first element of 'col1' is now 1\nassert_eq!(df.len(), 4);\n\n// Filter by string foo,\ndf.filter_by_row(|row| row[\"col3\"] != Datum::STR(\u0026\"foo\".to_string()));\nassert_eq!(df.len(), 2);\n```\n\n\n## and a whole lot more..\n\n\n---\n\n## Development\n\n- Rust \u003e= 1.31\n- [GSL](https://www.gnu.org/software/gsl/) ~= 2.4\n    - Fedora: `sudo dnf install gsl-devel`\n    - Ubuntu: `sudo apt-get install libgsl-dev`\n    - [Windows Install Instructions](https://www.gnu.org/software/gsl/extras/native_win_builds.html)\n\n---\n\n## Contributing\n\nAll contributions are welcome. Contributors of this project are expected to treat all\nothers with respect and dignity; acknowledging there will be differences of opinion\nand strive to provide a welcoming environment for others, regardless of skill level.\n\nAdditionally, all contributions, unless otherwise stated, will be given under the [Unlicense](http://unlicense.org/) \nand/or [MIT](https://en.wikipedia.org/wiki/MIT_License) licenses.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fblack-jack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilesgranger%2Fblack-jack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fblack-jack/lists"}