{ "info": { "author": "Santiago Larrain", "author_email": "santiagolarrain@gmail.com", "bugtrack_url": null, "classifiers": [], "description": ".. image:: https://img.shields.io/pypi/v/clchoropleth.svg\n :target: https://pypi.python.org/pypi/clchoropleth\n\nclChoropleth\n============\n\nIt creates a SVG Choropleth of a Chilean region. \n\nDescription\n-----------\nYou need a Dictionary or a Pandas.Series with the values. The index or key can be the Comuna name and the value an int. The package uses \"clcomuna\" to get the comuna code, and it creates bins for the values. You can specify the comuna region, even if your data has comunas for the hole country.\n\nInstallation\n------------\n::\n\n pip3 install clchoropleth\n\nRequirements\n------------\n\n- clcomuna\n- pandas\n- bf4 (BeautifulSoup)\n- Python3.3+\n\nUsage:\n------\n\n>>> import clchoropleth\n\nExample\n-------\n\n::\n\n import clchoropleth\n arica = {'ARICA': 27, 'CAMARONES': 13, 'GENERAL LAGOS': 10, 'PUTRE': 8}\n data = clchoropleth.prepare_data(arica)\n clchoropleth.run(data, \"arica.svg\", \"15\")\n\nThis should save an SVG file similar to this:\n\n.. image:: arica.png\n\n\n**prepare_data**\n\n``def prepare_data(data, t=70, noNone=False):``\n\nPrepares the dataset. If its a dictionary, it turns it into a pandas.Series object. \nIt checks the comuna name and uses its code instead. You can specify the threshold for the clcomuna package. \nIt aggregates by comuna code, so, for exmaple, if you have ``{'arica':10, 'Arica':11, 'ARICA':12}`` it will return ``'arica':33`` as a pd.Series.\nIt can drops the 'None's that you will get for below the threshold.\nReturns a pd.Series\n\n::\n\n arica = {'ARICA': 27, 'CAMARONES': 13, 'GENERAL LAGOS': 10, 'PUTRE': 8, 'arica': 33}\n clchoropleth.prepare_data(arica)\n >>>\n 15101 60\n 15102 13\n 15201 8\n 15202 10\n dtype: int64\n\n**select_comunas_from_region**\n\n``def select_comunas_from_region (data, region):``\n\nGiven the dataset (after prepare_data), returns a subset with only the comunas from the given region. 'region' must be a string.\n\n::\n\n data = {'ARICA': 27, 'CAMARONES': 13, 'GENERAL LAGOS': 10, 'PUTRE': 8, 'arica': 33, 'iquique': 123, 'santiago': 999}\n data_p = prepare_data(data)\n data_p\n >>>\n 01101 123\n 13101 999\n 15101 60\n 15102 13\n 15201 8\n 15202 10\n dtype: int64\n select_comunas_from_region(data_p, \"15\")\n >>>\n 15101 60\n 15102 13\n 15201 8\n 15202 10\n dtype: int64\n\n\n**discretize**\n\n``def discretize(data, bins=5, quantile=False):``\n\nChanges the values of the data into a bin number. You can specify a number of bins to be used and if to use 'quintile' based cut or not.\n::\n\n arica\n >>>\n 15101 60\n 15102 13\n 15201 8\n 15202 10\n dtype: int64\n discretize(arica)\n >>>\n 15101 4\n 15102 0\n 15201 0\n 15202 0\n dtype: category\n Categories (5, int64): [0 < 1 < 2 < 3 < 4]\n discretize(arica, 4, True)\n >>>\n 15101 3\n 15102 2\n 15201 0\n 15202 1\n dtype: category\n Categories (4, int64): [0 < 1 < 2 < 3]\n\n**make_map**\n\n``def make_map(data, filename, region, colors='orange'):``\n\nIt creates the choropleth map and saves it to filename destination.\n\nArgs:\n data: The pd.Series with the data. The index needs to be the code and the value the bin number.\n \n filename: The filename of the map we are going to save.\n \n region: we need to specify the region again, as a string (\"09\"), to open the original svg file and modify it.\n \n colors: it can be a string, if is one of the 5 pre-set color lists:\n orange, blue, green, red, pruple. Or it can be a list of strings, with each string being a color. For example:['#ffffcc','#c2e699','#78c679','#31a354','#006837']\n It needs to have the same length as the number of bins.\n For more colors: http://colorbrewer2.org/\n\nReturns:\n It saves the map. No return valule.\n\n\n**run**\n\n``def run(data, filename, region, colors='orange', bins=5, quantile=False):``\n\nIs a wrapper function that runs all the other functions of the module, except for 'preapare_data'. Doesn't return anything.\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/slarrain/clchoropleth", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "clchoropleth", "package_url": "https://pypi.org/project/clchoropleth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/clchoropleth/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/slarrain/clchoropleth" }, "release_url": "https://pypi.org/project/clchoropleth/1.2/", "requires_dist": null, "requires_python": null, "summary": "Creates SVG choropleths of Chilean regions", "version": "1.2" }, "last_serial": 2319711, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "0c7680a4ec6420ea751068eb2be4d693", "sha256": "ee7ccf439f61f1e1d6c95bc651bec24fb5176b3251b3fbe34a36cecd30ffdd60" }, "downloads": -1, "filename": "clchoropleth-1.0.tar.gz", "has_sig": false, "md5_digest": "0c7680a4ec6420ea751068eb2be4d693", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32587, "upload_time": "2016-09-01T19:27:34", "url": "https://files.pythonhosted.org/packages/6b/ca/27f6d0692b41e41ed59ea795f4f36c190c3c4ceef9ee53c3877b0289ce8f/clchoropleth-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "67a1b940fa7d9d80fa4285572370f63c", "sha256": "bcc5e58d39e28697b4796c7fefb4c37af9ecc23d7bf42301868f964732fd35e1" }, "downloads": -1, "filename": "clchoropleth-1.0.1.tar.gz", "has_sig": false, "md5_digest": "67a1b940fa7d9d80fa4285572370f63c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33258, "upload_time": "2016-09-01T20:35:30", "url": "https://files.pythonhosted.org/packages/da/1f/bbcc2069cf3f66bc54be9f0f9713a0053ebda820c27e81833eb3ecca1d24/clchoropleth-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "88f1ac9643ec71c647b5dd72919d71b6", "sha256": "985aee8cf5d992fb2f600773cb1024ed5b803388ca3778c39f869826dc44eb64" }, "downloads": -1, "filename": "clchoropleth-1.0.2.tar.gz", "has_sig": false, "md5_digest": "88f1ac9643ec71c647b5dd72919d71b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33283, "upload_time": "2016-09-01T20:40:45", "url": "https://files.pythonhosted.org/packages/71/1a/417293334adca7acb7b1026af44aeecd91315ec4238ba1d26e389a8f4d6e/clchoropleth-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "47fa9eba0e93a09b6cd84ac36e197447", "sha256": "745e712e2067771fe0e8789aa00510dfa82dd7feb130a9e2b820e627f3783f3e" }, "downloads": -1, "filename": "clchoropleth-1.0.3.tar.gz", "has_sig": false, "md5_digest": "47fa9eba0e93a09b6cd84ac36e197447", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33279, "upload_time": "2016-09-01T20:50:48", "url": "https://files.pythonhosted.org/packages/d0/9b/92e587318de7ea1b6bcc2b9034359a566b2dedc6b71cf28c88492ef1ce7b/clchoropleth-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "ff0214dbb93534d7dff09f5f4494faf4", "sha256": "71d0e9f809deb321fb844f6e610cc403f3c97fad2bb9e61759c322b8ee58f490" }, "downloads": -1, "filename": "clchoropleth-1.0.4.tar.gz", "has_sig": false, "md5_digest": "ff0214dbb93534d7dff09f5f4494faf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1158946, "upload_time": "2016-09-01T21:39:48", "url": "https://files.pythonhosted.org/packages/c6/15/393ff31240882f264436487e575bbd73d8f625869763caa9be11f37977c1/clchoropleth-1.0.4.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "e76bbedd3998f40fb8151ce088dcc4e7", "sha256": "cbb7c8c6e7e98a046ad3133e1e7adba38fe88e9a89d20674f4d7690f64150314" }, "downloads": -1, "filename": "clchoropleth-1.1.4.tar.gz", "has_sig": false, "md5_digest": "e76bbedd3998f40fb8151ce088dcc4e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1159058, "upload_time": "2016-09-01T22:13:00", "url": "https://files.pythonhosted.org/packages/7d/b1/71d8dbb5ed8a4a1546fb1cf8c1841160cbabc85a9b4874345d3efb88c9b9/clchoropleth-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "bbd7ee335048a378cd7b1d8ea0494e4c", "sha256": "af128df510e8a868e34aca21af02b645382bc4216270fd6a522dbc65633d173e" }, "downloads": -1, "filename": "clchoropleth-1.1.5.tar.gz", "has_sig": false, "md5_digest": "bbd7ee335048a378cd7b1d8ea0494e4c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1159058, "upload_time": "2016-09-01T22:16:56", "url": "https://files.pythonhosted.org/packages/ab/dc/b70e40b63e6a043ef97849e07e0b7154bed1749799a3553b86be52fb48cd/clchoropleth-1.1.5.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "ad7ed62de14826ded61b0d1d262e5b1f", "sha256": "871a9bb4599b360f6973408b61d8388d83b7cfec4fd93a4bee4ad98833b6e633" }, "downloads": -1, "filename": "clchoropleth-1.2.tar.gz", "has_sig": false, "md5_digest": "ad7ed62de14826ded61b0d1d262e5b1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1159069, "upload_time": "2016-09-01T22:25:46", "url": "https://files.pythonhosted.org/packages/d6/50/785be4c3ee816543c8ba1b8ddb9e385ee030a6c2cc1657089b2658b9a439/clchoropleth-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad7ed62de14826ded61b0d1d262e5b1f", "sha256": "871a9bb4599b360f6973408b61d8388d83b7cfec4fd93a4bee4ad98833b6e633" }, "downloads": -1, "filename": "clchoropleth-1.2.tar.gz", "has_sig": false, "md5_digest": "ad7ed62de14826ded61b0d1d262e5b1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1159069, "upload_time": "2016-09-01T22:25:46", "url": "https://files.pythonhosted.org/packages/d6/50/785be4c3ee816543c8ba1b8ddb9e385ee030a6c2cc1657089b2658b9a439/clchoropleth-1.2.tar.gz" } ] }