{"id":18332100,"url":"https://github.com/oneoffcoder/py-pair","last_synced_at":"2025-04-06T03:33:34.899Z","repository":{"id":39165674,"uuid":"312081802","full_name":"oneoffcoder/py-pair","owner":"oneoffcoder","description":"Pairwise association measures of statistical variable types","archived":false,"fork":false,"pushed_at":"2022-06-24T02:45:30.000Z","size":364,"stargazers_count":21,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T16:21:20.387Z","etag":null,"topics":["apache-spark","association","asymmetric","binary-variable","biserial","categorical-variable","causation","concordance","confusion-matrix","contingency-table","continuous-variable","correlation","interval-variable","nominal-variable","ordinal-variable","ranking","ratio-variable","symmetric"],"latest_commit_sha":null,"homepage":"https://py-pair.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oneoffcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"vangj","patreon":"vangj","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://oneoffcoder.com/"}},"created_at":"2020-11-11T20:26:51.000Z","updated_at":"2024-09-26T08:37:28.000Z","dependencies_parsed_at":"2022-08-18T14:11:32.012Z","dependency_job_id":null,"html_url":"https://github.com/oneoffcoder/py-pair","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpy-pair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpy-pair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpy-pair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneoffcoder%2Fpy-pair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oneoffcoder","download_url":"https://codeload.github.com/oneoffcoder/py-pair/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430838,"owners_count":20937873,"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":["apache-spark","association","asymmetric","binary-variable","biserial","categorical-variable","causation","concordance","confusion-matrix","contingency-table","continuous-variable","correlation","interval-variable","nominal-variable","ordinal-variable","ranking","ratio-variable","symmetric"],"created_at":"2024-11-05T19:37:22.323Z","updated_at":"2025-04-06T03:33:34.199Z","avatar_url":"https://github.com/oneoffcoder.png","language":"Python","readme":"![pypair logo](https://py-pair.readthedocs.io/_images/logo.png)\n\n# PyPair\n\nPyPair is a statistical library to compute pairwise association between any two variables. In general, statistical variable types are viewed as `categorical` or `continuous`. Categorical variables have no inherit order to their values, while continuous variables do. This API has `over 130 association measures` implemented for any combination of categorical and/or continuous variables. \n\nTo install.\n\n```bash\npip install pypair\n```\n\nAdditional links.\n\n- [Documentation](https://py-pair.readthedocs.io/)\n- [PyPi](https://pypi.org/project/pypair/) \n- [Gitter](https://gitter.im/dataflava/py-pair)\n\nHere's a short and sweet snippet for using the API against a dataframe that stores strictly binary data. The Pandas `DataFrame.corr()` method no longer processes non-numeric fields!\n\n```python\nfrom pypair.association import binary_binary\nfrom pypair.util import corr\n\njaccard = lambda a, b: binary_binary(a, b, measure='jaccard')\ntanimoto = lambda a, b: binary_binary(a, b, measure='tanimoto_i')\n\ndf = get_a_pandas_binary_dataframe()\n\njaccard_corr = corr(df, jaccard)\ntanimoto_corr = corr(df, tanimoto)\n\nprint(jaccard_corr)\nprint('-' * 15)\nprint(tanimoto_corr)\n```\n\nAnother way to get started with PyPair is to use the `convenience` methods whose names indicate the variable pair types.\n\n```python\nfrom pypair.association import binary_binary, categorical_categorical, \\\n    binary_continuous, concordance, categorical_continuous, continuous_continuous, confusion, agreement\n\n# assume a and b are the appropriate iterables of values for 2 variables\njaccard = binary_binary(a, b, measure='jaccard')\nacc = confusion(a, b, measure='acc')\nphi = categorical_categorical(a, b, measure='phi')\nkappa = agreement(a, b, measure='cohen_k')\nbiserial = binary_continuous(a, b, measure='biserial')\ntau = concordance(a, b, measure='kendall_tau')\neta = categorical_continuous(a, b, measure='eta')\npearson = continuous_continuous(a, b, measure='pearson')\n```\n\n# Software Copyright\n\n```\nCopyright 2020 One-Off Coder\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n# Book Copyright\n\nCopyright 2020 One-Off Coder\n\nThis work is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) by [One-Off Coder](https://www.oneoffcoder.com).\n\n![Creative Commons Attribution 4.0 International License](https://i.creativecommons.org/l/by/4.0/88x31.png \"Creative Commons Attribution 4.0 International License\")\n\n# Art Copyright\n\nCopyright 2020 Daytchia Vang\n\n# Citation\n\n```\n@misc{oneoffcoder_pypair_2020,\ntitle={PyPair, A Statistical API for Bivariate Association Measures},\nurl={https://github.com/oneoffcoder/py-pair},\nauthor={Jee Vang},\nyear={2020},\nmonth={Nov}}\n```\n\n# Sponsor, Love\n\n- [Patreon](https://www.patreon.com/vangj)\n- [GitHub](https://github.com/sponsors/vangj)","funding_links":["https://github.com/sponsors/vangj","https://patreon.com/vangj","https://oneoffcoder.com/","https://www.patreon.com/vangj"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneoffcoder%2Fpy-pair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneoffcoder%2Fpy-pair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneoffcoder%2Fpy-pair/lists"}