{ "info": { "author": "Adam Bulow", "author_email": "adamjbulow@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "=================\nus_polygon_mapper\n=================\n\nus_polygon_mapper allows users to create polygon maps of the United States from csv\u2019s, python dictionaries and pandas DataFrames. The script utilizes Google Maps API (gmplot wrapper). You can create html files and png\u2019s (when a png is created, an html is also created). PhantomJS must be installed to create png\u2019s (see below).\n\n.. image:: example.png\n :width: 400 px\n :height: 225px\n\n\nBasics\n======\nTo install:\n::\n\n pip install us_polygon_mapper\n\nTo use:\n::\n\n #!/usr/bin/env python\n \n import us_polygon_mapper.us_polygon_mapper as uspm\n\n\nYou can use any of the following as data inputs:\n\n1. A csv with a column containing states (full or abbreviated) and another column containing values\n2. A dictionary of the form {state1: value1, state2: value2}\n3. A pandas DataFrame with a column containing states (full or abbreviated) and another column containing values\n\nThe map works by splitting your data into two groups. The \u201clow\u201d group will contain all data points <= the \u201cmiddle\u201d (by default, the mean). The \u201chigh\u201d group will contain all the data points > the \u201cmiddle\u201d.\n\nA color is specified for the \u201clow\u201d group and the \u201chigh\u201d group (by default: green and red respectively).\n\nColors: \u2018red\u2019, \u2018orange\u2019, \u2018yellow\u2019, \u2018green\u2019, \u2018blue\u2019, \u2018purple\u2019, \u2018brown\u2019\n\nMiddle: \u2018mean\u2019, \u2018median\u2019, float, \u2018percentile=x\u2019 (x: 0-100)\n\nBy default, for csv\u2019s and pandas DataFrames, the states column is assumed to be column 0, and the values column is assumed to be column 1.\n\nYou can change this by passing the argument columns=[state_column_num, value_column_num] (e.g. [2, 3]) or columns=[state_column_name, value_column_name] (e.g. [\u2018state\u2019, \u2018debt\u2019]).\n\n\nUse case:\n=========\n\nFor example, you could use this package to create a map of election results. You could make your values GOP% - DEM% for each state. You would then set your \u201cmiddle\u201d to be 0, \u201clow color\u201d to be blue and \u201chigh color\u201d to be red. See example.py.\n\n\nMain Functions\n==============\n\nThe main functions are:\n\n* uspm.dict_to_html(values_dict, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, html_fn=\u201cmymap.html\u201d)\n\n* uspm.csv_to_html(csv_path, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, columns=None, html_fn=\u201cmymap.html\u201d)\n\n* uspm.df_to_html(df, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, columns=None, html_fn=\u201cmymap.html\u201d)\n\n* uspm.dict_to_png(values_dict, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, png_fn=\u201cmymap.png\u201d, html_fn=\u201cmymap.html\u201d)\n\n* uspm.csv_to_png(csv_path, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, columns=None, png_fn=\u201cmymap.png\u201d, html_fn=\u201cmymap.html\u201d)\n\n* uspm.df_to_png(df, low_color=\u201cgreen\u201d, high_color=\u201cred\u201d, middle=\u201cmean\u201d, columns=None, png_fn=\u201cmymap.png\u201d, html_fn=\u201cmymap.html\u201d)\n\n\ncolors: \u2018red\u2019, \u2018orange\u2019, \u2018yellow\u2019, \u2018green\u2019, \u2018blue\u2019, \u2018purple\u2019, \u2018brown\u2019\n\nmiddle: \u2018mean\u2019, \u2018median\u2019, float, \u2018percentile=x\u2019 (x: 0-100)\n\ncolumns: None (defaults to [0, 1]), [state_column_num, value_column_num] (e.g. [2, 3]), or [state_column_name, value_column_name] (e.g. [\u2018state\u2019, \u2018debt\u2019])\n\n\nRemark on png\u2019s\n===============\n\nTo create png\u2019s, you must have PhantomJS installed .\n\n**Mac:**\n\n(With Homebrew) Enter \u201cbrew install phantomjs\u201d in Terminal\n\n**Windows:**\n\nDownload PhantomJS and place phantomjs.exe in your Path (full steps below for Windows 10).\n\n1. Download PhantomJS \n2. Go to Control Panel > System and Security > System\n3. Click \"Advanced system settings\" in the left panel\n4. Click Environment Variables...\n5. Either move phantomjs.exe to a folder in your Path, or add the folder phantomjs.exe is in to your Path.\n\n\nNotes\n=====\n\n* state coordinates: \n\n* state abbreviations: \n\n* 2016 election results: ", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/abulow/us_polygon_mapper", "keywords": "", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "us-polygon-mapper", "package_url": "https://pypi.org/project/us-polygon-mapper/", "platform": "", "project_url": "https://pypi.org/project/us-polygon-mapper/", "project_urls": { "Homepage": "https://github.com/abulow/us_polygon_mapper" }, "release_url": "https://pypi.org/project/us-polygon-mapper/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Create Google Maps US polygon maps from csv's, python dictionaries and pandas dataframes", "version": "1.0.1" }, "last_serial": 3105861, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "0fea8466dce059b59f1ebedc8cc7a3bd", "sha256": "b1d98aa48c532b4ac9653c0166d28f678f02f308cc698f231590a38eb288b405" }, "downloads": -1, "filename": "us_polygon_mapper-1.0.0.tar.gz", "has_sig": false, "md5_digest": "0fea8466dce059b59f1ebedc8cc7a3bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36270, "upload_time": "2017-08-02T22:59:42", "url": "https://files.pythonhosted.org/packages/9b/be/db08ebb3b276dae9647b65aa101a485aed533a3689d485b0f4308147e776/us_polygon_mapper-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "1b34f62f07f085a46254590bd3ae60cf", "sha256": "c87e6973abee85fe49c43f041bbdda06f04aeb62090b43733bf7fec19b614511" }, "downloads": -1, "filename": "us_polygon_mapper-1.0.1.tar.gz", "has_sig": false, "md5_digest": "1b34f62f07f085a46254590bd3ae60cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36264, "upload_time": "2017-08-18T09:00:55", "url": "https://files.pythonhosted.org/packages/76/8e/169860dc1610843044bc1adb2519496692e40e50503d9791f4ea97dd31cc/us_polygon_mapper-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1b34f62f07f085a46254590bd3ae60cf", "sha256": "c87e6973abee85fe49c43f041bbdda06f04aeb62090b43733bf7fec19b614511" }, "downloads": -1, "filename": "us_polygon_mapper-1.0.1.tar.gz", "has_sig": false, "md5_digest": "1b34f62f07f085a46254590bd3ae60cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36264, "upload_time": "2017-08-18T09:00:55", "url": "https://files.pythonhosted.org/packages/76/8e/169860dc1610843044bc1adb2519496692e40e50503d9791f4ea97dd31cc/us_polygon_mapper-1.0.1.tar.gz" } ] }