{"id":27747524,"url":"https://github.com/Quantco/dataframely","last_synced_at":"2025-04-28T21:01:24.603Z","repository":{"id":288436493,"uuid":"968069920","full_name":"Quantco/dataframely","owner":"Quantco","description":"A declarative, 🐻‍❄️-native data frame validation library.","archived":false,"fork":false,"pushed_at":"2025-04-25T13:23:26.000Z","size":174,"stargazers_count":136,"open_issues_count":4,"forks_count":3,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-25T14:34:54.841Z","etag":null,"topics":["dataframe","polars","validation"],"latest_commit_sha":null,"homepage":"https://dataframely.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quantco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-17T13:06:59.000Z","updated_at":"2025-04-25T06:47:32.000Z","dependencies_parsed_at":"2025-04-21T06:00:37.349Z","dependency_job_id":null,"html_url":"https://github.com/Quantco/dataframely","commit_stats":null,"previous_names":["quantco/dataframely"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fdataframely","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fdataframely/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fdataframely/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fdataframely/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quantco","download_url":"https://codeload.github.com/Quantco/dataframely/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251389338,"owners_count":21581779,"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":["dataframe","polars","validation"],"created_at":"2025-04-28T21:00:56.864Z","updated_at":"2025-04-28T21:01:24.487Z","avatar_url":"https://github.com/Quantco.png","language":"Python","funding_links":[],"categories":["Libraries/Packages/Scripts","Recently Updated"],"sub_categories":["Polars plugins","[Apr 28, 2025](/content/2025/04/28/README.md)"],"readme":"\u003c!-- LOGO --\u003e\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003ch3 align=\"center\"\u003e\n  \u003ccode\u003edataframely\u003c/code\u003e — A declarative, 🐻‍❄️-native data frame validation library\n  \u003c/h3\u003e\n\n[![CI](https://img.shields.io/github/actions/workflow/status/quantco/dataframely/ci.yml?style=flat-square\u0026branch=main)](https://github.com/quantco/dataframely/actions/workflows/ci.yml)\n[![conda-forge](https://img.shields.io/conda/vn/conda-forge/dataframely?logoColor=white\u0026logo=conda-forge\u0026style=flat-square)](https://prefix.dev/channels/conda-forge/packages/dataframely)\n[![pypi-version](https://img.shields.io/pypi/v/dataframely.svg?logo=pypi\u0026logoColor=white\u0026style=flat-square)](https://pypi.org/project/dataframely)\n[![python-version](https://img.shields.io/pypi/pyversions/dataframely?logoColor=white\u0026logo=python\u0026style=flat-square)](https://pypi.org/project/dataframely)\n[![codecov](https://codecov.io/gh/Quantco/dataframely/graph/badge.svg)](https://codecov.io/gh/Quantco/dataframely)\n\n\u003c/div\u003e\n\n## 🗂 Table of Contents\n\n- [Introduction](#-introduction)\n- [Installation](#-installation)\n- [Usage](#-usage)\n\n## 📖 Introduction\n\nDataframely is a Python package to validate the schema and content of [`polars`](https://pola.rs/) data frames. Its\npurpose is to make data pipelines more robust by ensuring that data meets expectations and more readable by adding\nschema information to data frame type hints.\n\n## 💿 Installation\n\nYou can install `dataframely` using your favorite package manager, e.g., `pixi` or `pip`:\n\n```bash\npixi add dataframely\npip install dataframely\n```\n\n## 🎯 Usage\n\n### Defining a data frame schema\n\n```python\nimport dataframely as dy\nimport polars as pl\n\nclass HouseSchema(dy.Schema):\n    zip_code = dy.String(nullable=False, min_length=3)\n    num_bedrooms = dy.UInt8(nullable=False)\n    num_bathrooms = dy.UInt8(nullable=False)\n    price = dy.Float64(nullable=False)\n\n    @dy.rule()\n    def reasonable_bathroom_to_bedrooom_ratio() -\u003e pl.Expr:\n        ratio = pl.col(\"num_bathrooms\") / pl.col(\"num_bedrooms\")\n        return (ratio \u003e= 1 / 3) \u0026 (ratio \u003c= 3)\n\n    @dy.rule(group_by=[\"zip_code\"])\n    def minimum_zip_code_count() -\u003e pl.Expr:\n        return pl.len() \u003e= 2\n```\n\n### Validating data against schema\n\n```python\n\nimport polars as pl\n\ndf = pl.DataFrame({\n    \"zip_code\": [\"01234\", \"01234\", \"1\", \"213\", \"123\", \"213\"],\n    \"num_bedrooms\": [2, 2, 1, None, None, 2],\n    \"num_bathrooms\": [1, 2, 1, 1, 0, 8],\n    \"price\": [100_000, 110_000, 50_000, 80_000, 60_000, 160_000]\n})\n\n# Validate the data and cast columns to expected types\nvalidated_df: dy.DataFrame[HouseSchema] = HouseSchema.validate(df, cast=True)\n```\n\nSee more advanced usage examples in the [documentation](https://dataframely.readthedocs.io/en/latest/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuantco%2Fdataframely","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQuantco%2Fdataframely","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuantco%2Fdataframely/lists"}