stat-box


Namestat-box JSON
Version 0.1.4.post1 PyPI version JSON
download
home_pagehttps://gitlab.com/dmatryus.sqrt49/stat_box
SummaryConvinient statistical description of dataframes and time series.
upload_time2023-08-30 11:11:08
maintainer
docs_urlNone
authordmatryus
requires_python
licenseMIT
keywords statics time_series
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Welcome to Stat Box рџ‘‹

![Version](https://img.shields.io/badge/version-0.1.4-blue.svg?cacheSeconds=2592000)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://gitlab.com/dmatryus.sqrt49/stat_box/-/blob/b6399bd3cc0f3282c2a54bc9b8952456723ccada/LICENSE)

> A low-code python utility for fast statistics collection

# Install

```sh
pip install stat-box
```

# Usage

## Statistics

```python3
from stat_box.statistic import StatisticSet, Quantile, 
import pandas as pd

df = pd.DataFrame(
    {"1": {"a": 1, "b": 2}, "2": {"a": 3, "b": 3}, "3": {"a": "1", "b": "d"}}
)
print(StatisticSet({Quantile(i / 100) for i in range(1, 100)}).stat_table(df))

# The same
print(QUANTILE_SET.stat_table(df))
```

## Time series

```python3
from stat_box.time_series import TimeSeries, plot, group, rolling_trend, exp1, exp2, linear_trend, diff
import pandas as pd
from datetime import datetime
from dateutil.relativedelta import relativedelta
import numpy as np


# Generate data
data = pd.DataFrame(
    {
        "time": [datetime.now() + relativedelta(days=i) for i in range(365)],
        "value": [
            np.random.randint(-30, 30) + np.random.randint(-i / 7, i / 3 + 1)
            for i in range(365)
        ],
    }
)
# Indexed data
ts = TimeSeries(data)
ts.set_index('time')
plot(ts, title="Indexed data")
# Grouped data
gts = group(ts, "30d")
plot(gts, title="Grouped data")
# Rolling trend
rts = rolling_trend(ts, "30d")
plot(rts, title="Rolling trend")
# EXP_1
alpha = 0.02
e1ts = exp1(ts, alpha)
plot(e1ts, title=f"Exp_1 a trend (alpha = {alpha})")
# EXP_2
alpha = 0.6
beta = 0.9
e2ts = exp2(ts, alpha, beta)
plot(e2ts, title=f"Exp_2 a trend (alpha = {alpha} beta={beta})")
# Linear trend
lts = linear_trend(rts)
plot(lts, title="Linear trend")
# Diff
sdts = diff(rts, "sequential", True)
plot(sdts, title="Sequential diff of rolling data")
edts = diff(rts, "end", True)
plot(edts, title="End diff of rolling data")
ledrs = linear_trend(edts)
plot([edts, ledrs], legend=['edts', 'ledrs'], title="Linear trend of end dif of rolling data")
```

# Author

👤 **dmatryus**

* Github: [@dmatryus.sqrt49](https://github.com/dmatryus.sqrt49)

# рџ¤ќ Contributing

Contributions, issues and feature requests are welcome!

Feel free to check [issues page](https://gitlab.com/dmatryus.sqrt49/stat_box/-/issues). PRs are welcome!

# Show your support

Give a в­ђпёЏ if this project helped you!

# рџ“ќ License

Copyright В© 2021 [dmatryus](https://github.com/dmatryus.sqrt49).

This project
is [MIT](https://gitlab.com/dmatryus.sqrt49/stat_box/-/blob/main/LICENSE?ref_type=heads)
licensed.

***
_This README was generated with вќ¤пёЏ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/dmatryus.sqrt49/stat_box",
    "name": "stat-box",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "STATICS,TIME_SERIES",
    "author": "dmatryus",
    "author_email": "dmatryus.sqrt49@yandex.ru",
    "download_url": "https://files.pythonhosted.org/packages/73/0b/77c4d5579a240f53b43f1ab3763696cf66795ed1e45b2e495af0d6c0158f/stat_box-0.1.4.post1.tar.gz",
    "platform": null,
    "description": "# Welcome to Stat Box \u0440\u045f\u2018\u2039\r\n\r\n![Version](https://img.shields.io/badge/version-0.1.4-blue.svg?cacheSeconds=2592000)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://gitlab.com/dmatryus.sqrt49/stat_box/-/blob/b6399bd3cc0f3282c2a54bc9b8952456723ccada/LICENSE)\r\n\r\n> A low-code python utility for fast statistics collection\r\n\r\n# Install\r\n\r\n```sh\r\npip install stat-box\r\n```\r\n\r\n# Usage\r\n\r\n## Statistics\r\n\r\n```python3\r\nfrom stat_box.statistic import StatisticSet, Quantile, \r\nimport pandas as pd\r\n\r\ndf = pd.DataFrame(\r\n    {\"1\": {\"a\": 1, \"b\": 2}, \"2\": {\"a\": 3, \"b\": 3}, \"3\": {\"a\": \"1\", \"b\": \"d\"}}\r\n)\r\nprint(StatisticSet({Quantile(i / 100) for i in range(1, 100)}).stat_table(df))\r\n\r\n# The same\r\nprint(QUANTILE_SET.stat_table(df))\r\n```\r\n\r\n## Time series\r\n\r\n```python3\r\nfrom stat_box.time_series import TimeSeries, plot, group, rolling_trend, exp1, exp2, linear_trend, diff\r\nimport pandas as pd\r\nfrom datetime import datetime\r\nfrom dateutil.relativedelta import relativedelta\r\nimport numpy as np\r\n\r\n\r\n# Generate data\r\ndata = pd.DataFrame(\r\n    {\r\n        \"time\": [datetime.now() + relativedelta(days=i) for i in range(365)],\r\n        \"value\": [\r\n            np.random.randint(-30, 30) + np.random.randint(-i / 7, i / 3 + 1)\r\n            for i in range(365)\r\n        ],\r\n    }\r\n)\r\n# Indexed data\r\nts = TimeSeries(data)\r\nts.set_index('time')\r\nplot(ts, title=\"Indexed data\")\r\n# Grouped data\r\ngts = group(ts, \"30d\")\r\nplot(gts, title=\"Grouped data\")\r\n# Rolling trend\r\nrts = rolling_trend(ts, \"30d\")\r\nplot(rts, title=\"Rolling trend\")\r\n# EXP_1\r\nalpha = 0.02\r\ne1ts = exp1(ts, alpha)\r\nplot(e1ts, title=f\"Exp_1 a trend (alpha = {alpha})\")\r\n# EXP_2\r\nalpha = 0.6\r\nbeta = 0.9\r\ne2ts = exp2(ts, alpha, beta)\r\nplot(e2ts, title=f\"Exp_2 a trend (alpha = {alpha} beta={beta})\")\r\n# Linear trend\r\nlts = linear_trend(rts)\r\nplot(lts, title=\"Linear trend\")\r\n# Diff\r\nsdts = diff(rts, \"sequential\", True)\r\nplot(sdts, title=\"Sequential diff of rolling data\")\r\nedts = diff(rts, \"end\", True)\r\nplot(edts, title=\"End diff of rolling data\")\r\nledrs = linear_trend(edts)\r\nplot([edts, ledrs], legend=['edts', 'ledrs'], title=\"Linear trend of end dif of rolling data\")\r\n```\r\n\r\n# Author\r\n\r\n\u0440\u045f\u2018\u00a4 **dmatryus**\r\n\r\n* Github: [@dmatryus.sqrt49](https://github.com/dmatryus.sqrt49)\r\n\r\n# \u0440\u045f\u00a4\u045c Contributing\r\n\r\nContributions, issues and feature requests are welcome!\r\n\r\nFeel free to check [issues page](https://gitlab.com/dmatryus.sqrt49/stat_box/-/issues). PRs are welcome!\r\n\r\n# Show your support\r\n\r\nGive a \u0432\u00ad\u0452\u043f\u0451\u040f if this project helped you!\r\n\r\n# \u0440\u045f\u201c\u045c License\r\n\r\nCopyright \u0412\u00a9 2021 [dmatryus](https://github.com/dmatryus.sqrt49).\r\n\r\nThis project\r\nis [MIT](https://gitlab.com/dmatryus.sqrt49/stat_box/-/blob/main/LICENSE?ref_type=heads)\r\nlicensed.\r\n\r\n***\r\n_This README was generated with \u0432\u045c\u00a4\u043f\u0451\u040f by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convinient statistical description of dataframes and time series.",
    "version": "0.1.4.post1",
    "project_urls": {
        "Homepage": "https://gitlab.com/dmatryus.sqrt49/stat_box"
    },
    "split_keywords": [
        "statics",
        "time_series"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "730b77c4d5579a240f53b43f1ab3763696cf66795ed1e45b2e495af0d6c0158f",
                "md5": "234ae864af10a11b6cbb00466ee60375",
                "sha256": "68a78292daffe21fa7e976aeae4e14263715cae7b58ae361ea50bcafbb10ec01"
            },
            "downloads": -1,
            "filename": "stat_box-0.1.4.post1.tar.gz",
            "has_sig": false,
            "md5_digest": "234ae864af10a11b6cbb00466ee60375",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9613,
            "upload_time": "2023-08-30T11:11:08",
            "upload_time_iso_8601": "2023-08-30T11:11:08.509902Z",
            "url": "https://files.pythonhosted.org/packages/73/0b/77c4d5579a240f53b43f1ab3763696cf66795ed1e45b2e495af0d6c0158f/stat_box-0.1.4.post1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-30 11:11:08",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "dmatryus.sqrt49",
    "gitlab_project": "stat_box",
    "lcname": "stat-box"
}
        
Elapsed time: 0.11376s