{"id":15406791,"url":"https://github.com/dannyben/datamix","last_synced_at":"2025-07-31T05:09:23.586Z","repository":{"id":56683652,"uuid":"83815901","full_name":"DannyBen/datamix","owner":"DannyBen","description":"DSL for manipulating tabular data","archived":false,"fork":false,"pushed_at":"2024-01-09T09:01:14.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T18:53:00.380Z","etag":null,"topics":["csv","data","data-analysis","data-engineering","gem","ruby","tabular-data"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DannyBen.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-03T16:00:33.000Z","updated_at":"2024-04-08T06:24:45.000Z","dependencies_parsed_at":"2024-01-12T00:28:33.717Z","dependency_job_id":"60f37d7d-6b63-4419-b29a-d3b661cc8e1c","html_url":"https://github.com/DannyBen/datamix","commit_stats":{"total_commits":70,"total_committers":2,"mean_commits":35.0,"dds":"0.44285714285714284","last_synced_commit":"861a8a218d7a2feadc0633b6f5d4f7be46cb8ba3"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/DannyBen/datamix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fdatamix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fdatamix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fdatamix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fdatamix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DannyBen","download_url":"https://codeload.github.com/DannyBen/datamix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fdatamix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267989019,"owners_count":24177020,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csv","data","data-analysis","data-engineering","gem","ruby","tabular-data"],"created_at":"2024-10-01T16:25:24.380Z","updated_at":"2025-07-31T05:09:23.568Z","avatar_url":"https://github.com/DannyBen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"DataMix - DSL for manipulating tabular data\n==================================================\n\n[![Gem Version](https://badge.fury.io/rb/datamix.svg)](https://badge.fury.io/rb/datamix)\n[![Build Status](https://github.com/DannyBen/datamix/workflows/Test/badge.svg)](https://github.com/DannyBen/datamix/actions?query=workflow%3ATest)\n[![Maintainability](https://api.codeclimate.com/v1/badges/7af46250a35a02dfa0d4/maintainability)](https://codeclimate.com/github/DannyBen/datamix/maintainability)\n\n---\n\nThis library refines Ruby's [`CSV::Table`][1] and `Array` objects to provide \na DSL for manipulating tabular data.\n\n---\n\n\nInstall\n--------------------------------------------------\n\n```\n$ gem install datamix\n```\n\nOr with bundler:\n\n```ruby\ngem 'datamix'\n```\n\n\n\nExample Usage\n--------------------------------------------------\n\n```ruby\nrequire 'datamix'\nusing DataMix\n\n# Load data (this is a shortcut to load a CSV::Table object)\nsp500 = file 'sp500.csv'\nvix   = file 'vix.csv'\n\n# Keep only desired columns, rename and round data\nsp500.keep :date, :adjusted_close\nsp500.rename :adjusted_close, to: :close\nsp500.round :close, decimals: 2\n\n# Calculate a Change column, based on the Close column and round\nsp500[:change] = sp500[:close] - sp500[:close].prev\nsp500.round :change, decimals: 2\n\n# Keep only desired columns and rename\nvix.keep :date, :adjusted_close\nvix.rename :adjusted_close, to: :vix\n\n# Join the two tables\nsp500.join vix, on: :date\n\n# Remove all rows that have any empty value\nsp500.delete_empty_rows\n\n# Save and preview\nsp500.save_as 'output.csv'\nsp500.preview\n\n# Output\n# +------------+---------+--------+-------+\n# | date       | close   | change | vix   |\n# +------------+---------+--------+-------+\n# | 2015-03-12 | 2065.95 | 25.71  | 15.42 |\n# | 2015-03-13 | 2053.4  | -12.55 | 16.0  |\n# | 2015-03-16 | 2081.19 | 27.79  | 15.61 |\n# | 2015-03-17 | 2074.28 | -6.91  | 15.66 |\n# | 2015-03-18 | 2099.5  | 25.22  | 13.97 |\n# | 2015-03-19 | 2089.27 | -10.23 | 14.07 |\n# | 2015-03-20 | 2108.1  | 18.83  | 13.02 |\n# | 2015-03-23 | 2104.42 | -3.68  | 13.41 |\n# | 2015-03-24 | 2091.5  | -12.92 | 13.62 |\n# | 2015-03-25 | 2061.05 | -30.45 | 15.44 |\n# +------------+---------+--------+-------+\n```\n\nExamples\n--------------------------------------------------\n\nSee the [examples index][2] for more examples.\n\n[1]: https://ruby-doc.org/stdlib-2.3.1/libdoc/csv/rdoc/CSV/Table.html\n[2]: https://github.com/DannyBen/datamix/tree/master/examples#examples-index\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fdatamix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannyben%2Fdatamix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Fdatamix/lists"}