{"id":20304043,"url":"https://github.com/erp12/rica","last_synced_at":"2025-04-11T14:14:21.911Z","repository":{"id":80365720,"uuid":"137790424","full_name":"erp12/Rica","owner":"erp12","description":"DataFrame abstraction for Clojure data scientists.","archived":false,"fork":false,"pushed_at":"2018-11-28T00:46:22.000Z","size":106,"stargazers_count":6,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T10:22:00.794Z","etag":null,"topics":["clojure","clojurescript","data-science","dataframe"],"latest_commit_sha":null,"homepage":"https://erp12.github.io/Rica/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erp12.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-18T18:23:30.000Z","updated_at":"2021-09-14T14:57:55.000Z","dependencies_parsed_at":"2023-06-06T09:15:10.037Z","dependency_job_id":null,"html_url":"https://github.com/erp12/Rica","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erp12%2FRica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erp12%2FRica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erp12%2FRica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erp12%2FRica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erp12","download_url":"https://codeload.github.com/erp12/Rica/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248415431,"owners_count":21099664,"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":["clojure","clojurescript","data-science","dataframe"],"created_at":"2024-11-14T16:42:36.501Z","updated_at":"2025-04-11T14:14:21.901Z","avatar_url":"https://github.com/erp12.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rica\n\n[![CircleCI](https://circleci.com/gh/erp12/Rica.svg?style=svg)](https://circleci.com/gh/erp12/Rica)\n\nData-frame abstraction for Clojure data scientists.\n\nA Data-frame is a data structure where **r**ows are accessed by **i**ndex and **c**olumns are **a**ssociated with names. Hence the name **Rica**.\n\nRica offers a data-frame abstraction that can be broken down into two parts. First, a DataFrame type that implements a handful of Clojure interfaces and protocols and is compatible with most clojure functions that manipulate data-structures. Second, `rica.core` contains functions that make up a data-frame API inspired by [SparkSQL](https://spark.apache.org/sql/), [Pandas](https://pandas.pydata.org/), and [R](https://www.r-project.org/).\n\n\nRica aims to offer an intuavite abstraction for manipulating structured data, without requiring a special runtimes (like Spark). The consequence of this is that Rica is not (currently) ideal for large dataset, however it can be useful for smaller tasks and interactive data exploration.\n\n\n## Usage\n\nRica has not been put on Clojars yet.\n\n### Creating DataFrames\n\nThe `create-data-frame` function can create data-frames in a way that is similar to maps. Every other argument is a keyword that denotes a column name. The following argument is a collection (list of vector) denoting the values stored in that column.\n\n```clojure\n(require '[rica.core :refer :all])\n; nil\n\n(def df\n  (create-data-frame :name [\"alice\" \"bob\" \"eddie\"]\n                     :age [32 nil 24]))\n; #'data-frame.core/df\n\n(print-schema df)\n; root\n; |-- :name : java.lang.String\n; |-- :age : java.lang.Long\n; nil\n\n(show df)\n; | :name | :age |\n; |-------+------|\n; | alice |   32 |\n; |   bob |      |\n; | eddie |   24 |\n; nil\n```\n\nOften times datasets are stored as nested data structres. Rica provides 2 functions to\n\n\n### Some Example Pipelines\n\nSuppose we generate the following example dataset.\n\n```clojure\n(require '[data-frame.core :refer :all])\n\n(def sales\n  (create-data-frame\n    :sale-id [0 1 2 4 5 6 7 8 9]\n    :amount [74.24 31.24 10.40 22.78 58.24 14.26 61.56 13.95 58.15 69.87]\n    :num-items [3 2 1 2 3 3 2 1 3 1]\n    :customer-id [\"A\" \"C\" \"B\" \"A\" \"D\" nil \"B\" \"E\" \"A\" \"F\"]))\n```\n\nThe below snippet finds the biggest purchase made by customer \"A\".\n\n```clojure\n(-\u003e sales\n    (where #(= \"A\" (:customer-id %)))\n    (order-by :amount)\n    last\n    println)\n; #ordered/map ([:customer-id A] [:amount 58.15] [:num-items 3] [:sale-id 8])\n```\n\nThe below snippet finds the average cost of individual items purchased in each sale.\n\n```clojure\n(-\u003e sales\n    (select :amount :num-items)\n    (with-column :avg-item-cost #(/ (:amount %) (:num-items %)))\n    show)\n; | :amount | :num-items |     :avg-item-cost |\n; |---------+------------+--------------------|\n; |   34.24 |          3 | 11.413333333333334 |\n; |   31.24 |          2 |              15.62 |\n; |    10.4 |          1 |               10.4 |\n; |   22.78 |          2 |              11.39 |\n; |   58.24 |          3 | 19.413333333333334 |\n; |   14.26 |          3 |  4.753333333333333 |\n; |   61.56 |          2 |              30.78 |\n; |   13.95 |          1 |              13.95 |\n; |   58.15 |          3 | 19.383333333333333 |\n; |   69.87 |          1 |              69.87 |\n; nil\n```\n\n### Full API\n\nTutorial guides and full documenation are still under constrctions, however\nthe full API provided by all Rica namespaces can be found on\n[Rica's GitHub Pages site](https://erp12.github.io/Rica/index.html).\n\nGenerated using [Codox](https://github.com/weavejester/codox) Leiningen plugin.\n\n## Road Map / To Do\n\nFor a complete list of features being worked on, see the [project's GitHub issues](https://github.com/erp12/Rica/issues).\n\nIf you have any requests or encounter any issues using Rica, please open a GitHub issue (or pull request). A more complete contributing guide is coming soon.\n\n## License\n\nCopyright © 2018 Edward Pantridge\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferp12%2Frica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferp12%2Frica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferp12%2Frica/lists"}