convtools-1.3.0
توضیحات
dynamic, declarative data transformations with automatic code generation
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | convtools-1.3.0 |
| نام | convtools |
| نسخه کتابخانه | 1.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | ['Nikita Almakov <nikita.almakov@gmail.com>'] |
| نویسنده | - |
| ایمیل نویسنده | Nikita Almakov <nikita.almakov@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/convtools/ |
| مجوز | The MIT License (MIT) Copyright (c) 2021 Nikita Almakov Copyright (c) 2020 iTechArt Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
# convtools
**convtools** is a specialized Python library designed for defining data
transformations dynamically using a declarative approach. It automatically
generates custom Python code for the user in the background.
### ChatGPT's take on it :)
Introducing ConvTools, the revolutionary Python library for dynamic data
transformations! With its declarative approach, transforming data has never
been easier. Say goodbye to manual coding, ConvTools automatically
generates the code for you, saving you time and effort. Whether you're
working with large datasets or need to make real-time updates, ConvTools is
the solution you've been searching for. Get ready to experience the power
of efficient and effortless data transformation!
[](https://github.com/westandskif/convtools/blob/master/LICENSE.txt)
[]( https://codecov.io/gh/westandskif/convtools)
[](https://github.com/westandskif/convtools/actions/workflows/pytest.yml)
[](https://convtools.readthedocs.io/en/latest/?badge=latest)
[](https://pypi.org/project/convtools/)
[](https://twitter.com/convtools)
[](https://pepy.tech/project/convtools)
[](https://pypi.org/project/convtools/)
____
## Installation
`pip install convtools`
## Documentation
**[convtools.readthedocs.io](https://convtools.readthedocs.io/en/latest/)**
## Group by example
```python
from convtools import conversion as c
input_data = [
{"a": 5, "b": "foo"},
{"a": 10, "b": "foo"},
{"a": 10, "b": "bar"},
{"a": 10, "b": "bar"},
{"a": 20, "b": "bar"},
]
conv = (
c.group_by(c.item("b"))
.aggregate(
{
"b": c.item("b"),
"a_first": c.ReduceFuncs.First(c.item("a")),
"a_max": c.ReduceFuncs.Max(c.item("a")),
}
)
.pipe(
c.aggregate({
"b_values": c.ReduceFuncs.Array(c.item("b")),
"mode_a_first": c.ReduceFuncs.Mode(c.item("a_first")),
"median_a_max": c.ReduceFuncs.Median(c.item("a_max")),
})
)
.gen_converter()
)
assert conv(input_data) == {
'b_values': ['foo', 'bar'],
'mode_a_first': 10,
'median_a_max': 15.0
}
```
##### Built-in reducers like `c.ReduceFuncs.First`
* Sum
* SumOrNone
* Max
* MaxRow
* Min
* MinRow
* Count
* CountDistinct
* First
* Last
* Average
* Median
* Percentile
* Mode
* TopK
* Array
* ArrayDistinct
* ArraySorted
DICT REDUCERS ARE IN FACT AGGREGATIONS THEMSELVES, BECAUSE VALUES GET REDUCED.
* Dict
* DictArray
* DictSum
* DictSumOrNone
* DictMax
* DictMin
* DictCount
* DictCountDistinct
* DictFirst
* DictLast
AND LASTLY YOU CAN DEFINE YOUR OWN REDUCER BY PASSING ANY REDUCE FUNCTION
OF TWO ARGUMENTS TO ``c.reduce``.
## What's the point if there are tools like Pandas / Polars?
* convtools doesn't need to wrap data in a container to provide functionality,
it simply runs the python code it generates on **any input**
* convtools is lightweight (_though optional `black` is highly recommended for
pretty-printing generated code out of curiosity_)
* convtools fosters building pipelines on top of iterators, allowing for stream
processing
* convtools supports nested aggregations
* convtools is a set of primitives for code generation, so it's just different.
## Reporting a Security Vulnerability
See the [security policy](https://github.com/westandskif/convtools/security/policy).
نیازمندی
| مقدار | نام |
|---|---|
| xtr | hatch; |
| xtr | markdown-include; |
| xtr | mdx-truly-sane-lists; |
| xtr | mkdocs; |
| xtr | mkdocs-exclude; |
| xtr | mkdocs-material; |
| xtr | pygments; |
| xtr | pymdown-extensions; |
| xtr | black; |
| xtr | flake8; |
| xtr | isort; |
| xtr | mypy; |
| xtr | pylint; |
| xtr | pytest; |
| xtr | pytest-benchmark; |
| xtr | pytest-cov; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl convtools-1.3.0:
pip install convtools-1.3.0.whl
نصب پکیج tar.gz convtools-1.3.0:
pip install convtools-1.3.0.tar.gz