Metadata-Version: 2.4
Name: gcor
Version: 0.1.1
Summary: Generalized correlation measures
Author-email: Ryota Suzuki <suzuki@ef-prime.com>
License-File: LICENSE
Requires-Python: >=3.9
Requires-Dist: numpy>=1.21
Requires-Dist: pandas>=1.5
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: jupyter; extra == 'dev'
Requires-Dist: pdoc; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: pyyaml; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# A Python library for generalized correlation


A Python implementation of generalized correlation measure. For
development status and source code, see
<https://github.com/r-suzuki/gcor-py>.

**Note that this project is in an early stage of development, so changes
may occur frequently.**

## Installation

### PyPI

``` bash
pip install gcor
```

### GitHub (development version)

``` bash
pip install git+https://github.com/r-suzuki/gcor-py.git
```

## Examples

**Generalized correlation measure** takes values in $[0, 1]$ and can
capture both linear and nonlinear associations. It naturally handles
mixed data types, including numerical and categorical variables.

### Scalar example

``` python
from gcor import gcor

x = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
y = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7]

g = gcor(x, y)
print(g)
```

    0.5345224838248488

### Matrix example (mixed numeric and categorical data)

``` python
import pandas as pd

df = pd.DataFrame({
    "x": x,
    "y": y,
    "z": ["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"],
})

gmat = gcor(df)
print(gmat)
```

              x         y         z
    x  1.000000  0.534522  0.838289
    y  0.534522  1.000000  0.763233
    z  0.838289  0.763233  1.000000

## Documentation

### Method Overview

- [English](https://r-suzuki.github.io/gcor/method.html)
- [Japanese](https://r-suzuki.github.io/gcor/method_ja.html)
