{"id":22089910,"url":"https://github.com/dhchenx/correlation-kit","last_synced_at":"2025-07-22T14:05:21.426Z","repository":{"id":62564900,"uuid":"435257715","full_name":"dhchenx/correlation-kit","owner":"dhchenx","description":"A toolkit for estimating the correlation between variables","archived":false,"fork":false,"pushed_at":"2021-12-05T19:23:23.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-28T17:46:27.890Z","etag":null,"topics":["binary-variable","correlation-analysis","kendalltau","multi-category","pearson","spearman"],"latest_commit_sha":null,"homepage":"","language":"Python","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/dhchenx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-05T19:21:21.000Z","updated_at":"2021-12-25T14:50:28.000Z","dependencies_parsed_at":"2022-11-03T16:00:56.644Z","dependency_job_id":null,"html_url":"https://github.com/dhchenx/correlation-kit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dhchenx/correlation-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhchenx%2Fcorrelation-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhchenx%2Fcorrelation-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhchenx%2Fcorrelation-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhchenx%2Fcorrelation-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhchenx","download_url":"https://codeload.github.com/dhchenx/correlation-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhchenx%2Fcorrelation-kit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266507366,"owners_count":23940055,"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-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["binary-variable","correlation-analysis","kendalltau","multi-category","pearson","spearman"],"created_at":"2024-12-01T02:14:41.079Z","updated_at":"2025-07-22T14:05:21.397Z","avatar_url":"https://github.com/dhchenx.png","language":"Python","readme":"# Correlation Kit\n\nA toolkit for estimating the correlation values between variables\n\n## Installation\n```pip\npip install correlation-kit\n```\n\n## Correlation between two continual variables\n```python\nimport pandas as pd\nfrom correlation_kit.ck_wrapper import CorrelationKit\n\n# set a dataframe or read from a csv file\nd = {'x': [1, 2, 3.5, 4], 'y': [3, 4, 4.5, 6]}\ndf = pd.DataFrame(data=d)\n\n# set x label and y label for correlation\nx = \"x\"\ny = \"y\"\n\n# calc\ndef get_correlation(x, y, corr_type):\n    stat = 0\n    p = 0\n    if corr_type == \"pearson\":\n        stat, p = CorrelationKit(df).get_pearson(x, y)\n    elif corr_type == \"spearman\":\n        stat, p = CorrelationKit(df).get_spearman(x, y)\n    elif corr_type == \"kendalltau\":\n        stat, p = CorrelationKit(df).get_kendalltau(x, y)\n    return stat, p\n\n# print results\nprint(\"pearson = \", get_correlation(x, y, \"pearson\"))\nprint(\"spearman = \", get_correlation(x, y, \"spearman\"))\nprint(\"kendalltau = \", get_correlation(x, y, \"kendalltau\"))\n```\n\n## Estimate correlation between binary and continual variables\n```python\nimport pandas as pd\nfrom correlation_kit.ck_wrapper import CorrelationKit\n\n# set a dataframe or read from a csv file\nd = {'x': ['large', 'large', 'small', 'small'], 'y': ['hot', 'hot', 'cold', 'cold'],'z':[0,1,2.5,3]}\ndf = pd.DataFrame(data=d)\n\n# set x label and y label for correlation, which is suitable for binary variables\nr_p,r_s,r_k=CorrelationKit(df).get_corr_between_category_and_continual('x','large','z') # large=1; otherewise 0\n\n# results\nprint('pearson: ',r_p)\nprint('speraman: ',r_s)\nprint('kendalltau: ',r_k)\n\n```\n\n## Estimate F value between multiple-category variable and continual variables\n\n```python\nimport pandas as pd\nfrom ck_wrapper import CorrelationKit\n\n# set a dataframe or read from a csv file\nd = {'x': ['large', 'large', 'middle','small', 'small'], 'y': ['hot', 'hot','warm', 'cold', 'cold'],'z':[0,1,2,2.5,3]}\ndf = pd.DataFrame(data=d)\n\n# set x label and y label for correlation, which is suitable for multiple-category variables\nF,p=CorrelationKit(df).get_f_oneway('x',['large','middle','small'],'z')\n\n# results\nprint('F: ',F)\nprint('p: ',p)\n\n\n```\n\n## License\nThe `Correlation-Kit` project is provided by [Donghua Chen](https://github.com/dhchenx). \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhchenx%2Fcorrelation-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhchenx%2Fcorrelation-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhchenx%2Fcorrelation-kit/lists"}