{ "info": { "author": "Harry Yu", "author_email": "harryyunull@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# datatoaster\n[![Build Status](https://travis-ci.org/abc612008/datatoaster.svg?branch=master)](https://travis-ci.org/abc612008/datatoaster) [![codecov](https://codecov.io/gh/abc612008/datatoaster/branch/master/graph/badge.svg)](https://codecov.io/gh/abc612008/datatoaster) [![license](https://img.shields.io/github/license/abc612008/datatoaster.svg)](https://github.com/abc612008/datatoaster/blob/master/LICENSE)\n\ndatatoaster is a Python 3 library that can convert raw data to chart data so that it can used to generate charts easily. If you like this project or find it useful please consider giving me\u00a0a\u00a0GitHub\u00a0star. Much\u00a0appreciated! :)\n\nSuggestions are welcome!\n\n## Installation\nYou can install it via pip\n```\n$ pip install datatoaster\n```\nor manually install by\n```\n$ python3 setup.py install\n```\nYou can run unit tests by\n```\n$ python3 ./tests/tests.py\n```\n\n## Examples\n\nGiven a data set, I want to know how many percent of my users paid money (per OS).\n\n```python\n>>> data = [{\"PaidAmount\": 0, \"OS\": \"iOS\"}, {\"PaidAmount\": 0, \"OS\": \"Android\"}, {\"PaidAmount\": 301, \"OS\": \"Android\"}, {\"PaidAmount\": 0, \"OS\": \"Windows\"}, {\"PaidAmount\": 14, \"OS\": \"Windows\"}, {\"PaidAmount\": 56, \"OS\": \"iOS\"}, {\"PaidAmount\": 2, \"OS\": \"Windows\"}, {\"PaidAmount\": 0, \"OS\": \"Windows\"}]\n>>> datatoaster.DataSet(data) \\\n .set_x(lambda i: i[\"OS\"]) \\\n .set_y(datatoaster.DataSet.PercentageWithinGroup) \\\n .add_constraint(lambda i: i[\"PaidAmount\"] != 0) \\\n .get_result()\n \n{'Windows': 0.5, 'iOS': 0.5, 'Android': 0.5}\n```\n\nI can now know 50% users in each OS paid money to me! I can also use this data to draw chart.\n\nFor more examples, you can run `python3 ./demo/server.py`.\n\n## Documentation\n\nDataSet.set_x(DataSet.Single / function): Set X value\n\n DataSet.Single: equivalent to (lambda i:\"\")\n \n function: data_item -> desired_x_value\n \nDataSet.set_y(DataSet.NumberOfAppearance/DataSet.Percentage/DataSet.PercentageWithinGroup/function): Set Y value\n NumberOfAppearance: Y value will be the number of appearance of X.\n \n Percentage: Y value will be the percentage of appearance of X over the whole data set.\n \n PercentageWithinGroup: Y value will be the percentage of appearance of X over the group.\n \n function: [data_item] -> y_value / [y_values] Y value will be what your function returns.\n\nDataSet.get_result(): Get the final result\n Example 1: {\"x\":y, \"x2\":y2}\n Example 2: {\"x\":[y11,y12], \"x2\":[y21,y22]}\n\nDataSet.add_constraint(function, is_single): Add a constraint\n function: data_item -> boolean (indicates whether the value should be used)\n \n is_single: indicates if the constraint applies to \"whole data set\"(Only makes difference when .SetY(Percentage)), defaults to False.\n\nIt may seem confusing. You can refer to [unit tests](https://github.com/abc612008/datatoaster/blob/master/tests/tests.py) or [demo](https://github.com/abc612008/datatoaster/blob/master/demo/server.py) for more examples.\n## Licenses\n\ndatatoaster is released under the MIT License. See [LICENSE](https://github.com/abc612008/datatoaster/blob/master/LICENSE) for more information.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abc612008/datatoaster", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "datatoaster", "package_url": "https://pypi.org/project/datatoaster/", "platform": "", "project_url": "https://pypi.org/project/datatoaster/", "project_urls": { "Homepage": "https://github.com/abc612008/datatoaster" }, "release_url": "https://pypi.org/project/datatoaster/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "A Python library that can convert raw data to chart data", "version": "0.1.0" }, "last_serial": 3287194, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "adecfc6d3087a515604f75100372f8db", "sha256": "ae35851c223181afbd58948f13cc74d682e32c2e674c75015e28972c40a5a002" }, "downloads": -1, "filename": "datatoaster-0.1.0.zip", "has_sig": false, "md5_digest": "adecfc6d3087a515604f75100372f8db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7170, "upload_time": "2017-10-29T02:38:40", "url": "https://files.pythonhosted.org/packages/e6/9d/057b54551e2e0d41b9b8d66562b59516c9ddc20da852114c94d5149b3693/datatoaster-0.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "adecfc6d3087a515604f75100372f8db", "sha256": "ae35851c223181afbd58948f13cc74d682e32c2e674c75015e28972c40a5a002" }, "downloads": -1, "filename": "datatoaster-0.1.0.zip", "has_sig": false, "md5_digest": "adecfc6d3087a515604f75100372f8db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7170, "upload_time": "2017-10-29T02:38:40", "url": "https://files.pythonhosted.org/packages/e6/9d/057b54551e2e0d41b9b8d66562b59516c9ddc20da852114c94d5149b3693/datatoaster-0.1.0.zip" } ] }