cr.cube


Namecr.cube JSON
Version 3.0.42 PyPI version JSON
download
home_pagehttps://github.com/Crunch-io/crunch-cube/
SummaryCrunch.io Cube library
upload_time2024-03-19 15:29:40
maintainer
docs_urlNone
authorCrunch.io
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # crunch-cube

Open Source Python implementation of the API for working with CrunchCubes

## Introduction

This package contains the implementation of the CrunchCube API. It is used to
extract useful information from CrunchCube responses (we'll refer to them as
_cubes_ in the subsequent text). _Cubes_ are obtained from the *Crunch.io*
platform, as JSON responses to the specific _queries_ created by the user.
These queries specify which data the user wants to extract from the Crunch.io
system. The most common usage is to obtain the following:

 - Cross correlation between different variable
 - Margins of the cross tab _cube_
 - Proportions of the cross tab _cube_ (e.g. proportions of each single element to the entire sample size)
 - Percentages

When the data is obtained from the Crunch.io platform, it needs to be
interpreted to the form that's convenient for a user. The actual shape of the
_cube_ JSON contains many internal details, which are not of essence to the
end-user (but are still necessary for proper _cube_ functionality).

The job of this library is to provide a convenient API that handles those
intricacies, and enables the user to quickly and easily obtain (extract) the
relevant data from the _cube_. Such data is best represented in a table-like
format. For this reason, the most of the API functions return some form of the
`ndarray` type, from the `numpy` package. Each function is explained in greater
detail, uner its own section, under the API subsection of this document.

## Installation

The `cr.cube` package can be installed by using the `pip install`:

    pip install cr.cube


### For developers

For development mode, `cr.cube` needs to be installed from the local checkout
of the `crunch-cube` repository. It is strongly advised to use `virtualenv`.
Assuming you've created and activated a virtual environment `venv`, navigate
to the top-level folder of the repo, on the local file system, and run:

    pip install -e .

or

    python setup.py develop

### Running tests

To setup and run tests, you will need to install `cr.cube` as well as testing
dependencies. To do this, from the root directory, simply run:

    pip install -e .[testing]

And then tests can be run using `py.test` in the root directory:

    pytest

## Usage

After the `cr.cube` package has been successfully installed, the usage is as
simple as:


    >>> from cr.cube.cube import Cube

    >>> ### Obtain the crunch cube JSON payload using app.crunch.io, pycrunch, rcrunch or scrunch
    >>> ### And store it in the 'cube_JSON_response' variable

    >>> cube = Cube(cube_JSON_response)
    >>> print(cube)
    Cube(name='MyCube', dimension_types='CAT x CAT')
    >>> cube.counts
    np.array([[1169, 547],
              [1473, 1261]])

## API

### `as_array`

Tabular, or matrix, representation of the _cube_. The detailed description can
be found
[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).

### `margin`

Calculates margins of the _cube_. The detailed description can be found
[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).

### `proportions`

Calculates proportions of single variable elements to the whole sample size.
The detailed description can be found
[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).

### `percentages`

Calculates percentages of single variable elements to the whole sample size.
The detailed description can be found
[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).

---
[![Build Status](https://travis-ci.org/Crunch-io/crunch-cube.png?branch=master)](https://travis-ci.org/Crunch-io/crunch-cube)
[![Coverage Status](https://codecov.io/gh/Crunch-io/crunch-cube/branch/master/graph/badge.svg?token=C6auKOj8tZ)](https://codecov.io/gh/Crunch-io/crunch-cube)
[![Documentation Status](https://readthedocs.org/projects/crunch-cube/badge/?version=latest)](http://crunch-cube.readthedocs.io/en/latest/?badge=latest)
[![CodeFactor](https://www.codefactor.io/repository/github/crunch-io/crunch-cube/badge)](https://www.codefactor.io/repository/github/crunch-io/crunch-cube)
---

## Changes

### 3.0.42
- Inflate cubes that are single column filters

### 3.0.41
- Remove `deepcopy` from dimension module due to a performance issue

### 3.0.40
- Fix bug with weighted vs unweighted in pairwise effect calculation

### 3.0.39
- Remove cube response deepcopy due to a performance issue

### 3.0.38
- Improve calculation of DoF for pairwise comparison
- Use effective counts as column bases for DoF

### 3.0.37
- Add squared counts as a cube measure
- Enable calculating pairwise stats with effective denominator

### 3.0.36
- Fix bug in pairwise sig values for means.

### 3.0.35
- Fix bug where categorical dimension would sometimes be interpreted as `MR_CATS`.


For a complete list of changes see [history](https://github.com/Crunch-io/crunch-cube/blob/master/HISTORY.md).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Crunch-io/crunch-cube/",
    "name": "cr.cube",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Crunch.io",
    "author_email": "dev@crunch.io",
    "download_url": "https://files.pythonhosted.org/packages/d0/29/86709b3bb6eae4e07c793e1eb9ff971e9761f96d9df54481ba59135738ea/cr.cube-3.0.42.tar.gz",
    "platform": null,
    "description": "# crunch-cube\n\nOpen Source Python implementation of the API for working with CrunchCubes\n\n## Introduction\n\nThis package contains the implementation of the CrunchCube API. It is used to\nextract useful information from CrunchCube responses (we'll refer to them as\n_cubes_ in the subsequent text). _Cubes_ are obtained from the *Crunch.io*\nplatform, as JSON responses to the specific _queries_ created by the user.\nThese queries specify which data the user wants to extract from the Crunch.io\nsystem. The most common usage is to obtain the following:\n\n - Cross correlation between different variable\n - Margins of the cross tab _cube_\n - Proportions of the cross tab _cube_ (e.g. proportions of each single element to the entire sample size)\n - Percentages\n\nWhen the data is obtained from the Crunch.io platform, it needs to be\ninterpreted to the form that's convenient for a user. The actual shape of the\n_cube_ JSON contains many internal details, which are not of essence to the\nend-user (but are still necessary for proper _cube_ functionality).\n\nThe job of this library is to provide a convenient API that handles those\nintricacies, and enables the user to quickly and easily obtain (extract) the\nrelevant data from the _cube_. Such data is best represented in a table-like\nformat. For this reason, the most of the API functions return some form of the\n`ndarray` type, from the `numpy` package. Each function is explained in greater\ndetail, uner its own section, under the API subsection of this document.\n\n## Installation\n\nThe `cr.cube` package can be installed by using the `pip install`:\n\n    pip install cr.cube\n\n\n### For developers\n\nFor development mode, `cr.cube` needs to be installed from the local checkout\nof the `crunch-cube` repository. It is strongly advised to use `virtualenv`.\nAssuming you've created and activated a virtual environment `venv`, navigate\nto the top-level folder of the repo, on the local file system, and run:\n\n    pip install -e .\n\nor\n\n    python setup.py develop\n\n### Running tests\n\nTo setup and run tests, you will need to install `cr.cube` as well as testing\ndependencies. To do this, from the root directory, simply run:\n\n    pip install -e .[testing]\n\nAnd then tests can be run using `py.test` in the root directory:\n\n    pytest\n\n## Usage\n\nAfter the `cr.cube` package has been successfully installed, the usage is as\nsimple as:\n\n\n    >>> from cr.cube.cube import Cube\n\n    >>> ### Obtain the crunch cube JSON payload using app.crunch.io, pycrunch, rcrunch or scrunch\n    >>> ### And store it in the 'cube_JSON_response' variable\n\n    >>> cube = Cube(cube_JSON_response)\n    >>> print(cube)\n    Cube(name='MyCube', dimension_types='CAT x CAT')\n    >>> cube.counts\n    np.array([[1169, 547],\n              [1473, 1261]])\n\n## API\n\n### `as_array`\n\nTabular, or matrix, representation of the _cube_. The detailed description can\nbe found\n[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).\n\n### `margin`\n\nCalculates margins of the _cube_. The detailed description can be found\n[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).\n\n### `proportions`\n\nCalculates proportions of single variable elements to the whole sample size.\nThe detailed description can be found\n[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).\n\n### `percentages`\n\nCalculates percentages of single variable elements to the whole sample size.\nThe detailed description can be found\n[here](http://crunch-cube.readthedocs.io/en/latest/cr.cube.html#cr-cube-crunch-cube-module).\n\n---\n[![Build Status](https://travis-ci.org/Crunch-io/crunch-cube.png?branch=master)](https://travis-ci.org/Crunch-io/crunch-cube)\n[![Coverage Status](https://codecov.io/gh/Crunch-io/crunch-cube/branch/master/graph/badge.svg?token=C6auKOj8tZ)](https://codecov.io/gh/Crunch-io/crunch-cube)\n[![Documentation Status](https://readthedocs.org/projects/crunch-cube/badge/?version=latest)](http://crunch-cube.readthedocs.io/en/latest/?badge=latest)\n[![CodeFactor](https://www.codefactor.io/repository/github/crunch-io/crunch-cube/badge)](https://www.codefactor.io/repository/github/crunch-io/crunch-cube)\n---\n\n## Changes\n\n### 3.0.42\n- Inflate cubes that are single column filters\n\n### 3.0.41\n- Remove `deepcopy` from dimension module due to a performance issue\n\n### 3.0.40\n- Fix bug with weighted vs unweighted in pairwise effect calculation\n\n### 3.0.39\n- Remove cube response deepcopy due to a performance issue\n\n### 3.0.38\n- Improve calculation of DoF for pairwise comparison\n- Use effective counts as column bases for DoF\n\n### 3.0.37\n- Add squared counts as a cube measure\n- Enable calculating pairwise stats with effective denominator\n\n### 3.0.36\n- Fix bug in pairwise sig values for means.\n\n### 3.0.35\n- Fix bug where categorical dimension would sometimes be interpreted as `MR_CATS`.\n\n\nFor a complete list of changes see [history](https://github.com/Crunch-io/crunch-cube/blob/master/HISTORY.md).\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Crunch.io Cube library",
    "version": "3.0.42",
    "project_urls": {
        "Homepage": "https://github.com/Crunch-io/crunch-cube/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59eff109052c5612ca09d32b05b672f47f847e61b61c520d48a9a13994b86bd7",
                "md5": "960955636fa5013d88879d5b790a1860",
                "sha256": "58618a03797845ac91db036597d719d6ae2514af226058ca94c5cafa4cda355d"
            },
            "downloads": -1,
            "filename": "cr.cube-3.0.42-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "960955636fa5013d88879d5b790a1860",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 113805,
            "upload_time": "2024-03-19T15:29:37",
            "upload_time_iso_8601": "2024-03-19T15:29:37.656272Z",
            "url": "https://files.pythonhosted.org/packages/59/ef/f109052c5612ca09d32b05b672f47f847e61b61c520d48a9a13994b86bd7/cr.cube-3.0.42-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d02986709b3bb6eae4e07c793e1eb9ff971e9761f96d9df54481ba59135738ea",
                "md5": "29dad130b46ed4dc357b7d162756e944",
                "sha256": "0a332af3c8476348c17495bcf0cba231f2bb441f1f2af825d54ac62cb6410a27"
            },
            "downloads": -1,
            "filename": "cr.cube-3.0.42.tar.gz",
            "has_sig": false,
            "md5_digest": "29dad130b46ed4dc357b7d162756e944",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 1024985,
            "upload_time": "2024-03-19T15:29:40",
            "upload_time_iso_8601": "2024-03-19T15:29:40.938592Z",
            "url": "https://files.pythonhosted.org/packages/d0/29/86709b3bb6eae4e07c793e1eb9ff971e9761f96d9df54481ba59135738ea/cr.cube-3.0.42.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-19 15:29:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Crunch-io",
    "github_project": "crunch-cube",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "cr.cube"
}
        
Elapsed time: 0.21728s