{ "info": { "author": "Chris Amico", "author_email": "eyeseast@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Python TableFu is a tool for manipulating spreadsheet-like tables in Python. It began as a Python implementation of ProPublica's [TableFu](http://propublica.github.com/table-fu/), though new methods have been added. TableFu allows filtering, faceting and manipulating of data. Going forward, the project aims to create something akin to an ORM for spreadsheets.\n\nUsage:\n------\n\n >>> from table_fu import TableFu\n >>> table = TableFu.from_file('tests/test.csv')\n >>> table.columns\n ['Author', 'Best Book', 'Number of Pages', 'Style']\n\n # get all authors\n >>> table.values('Author')\n ['Samuel Beckett', 'James Joyce', 'Nicholson Baker', 'Vladimir Sorokin']\n\n # total a column\n >>> table.total('Number of Pages')\n 1177.0\n \n # filtering a table returns a new instance\n >>> t2 = table.filter(Style='Modernism')\n >>> list(t2)\n [,\n ]\n \n \n # each TableFu instance acts like a list of rows\n >>> table[0]\n \n \n list(table.rows)\n [,\n ,\n ,\n ]\n \n # rows, in turn, act like dictionaries\n >>> row = table[1]\n >>> print row['Author']\n James Joyce\n \n # transpose a table\n >>> t2 = table.transpose()\n >>> list(t2)\n [,\n ,\n ]\n \n >>> t2.columns\n ['Author',\n 'Samuel Beckett',\n 'James Joyce',\n 'Nicholson Baker',\n 'Vladimir Sorokin']\n \n # sort rows\n >>> table.sort('Author')\n >>> table.rows\n [,\n ,\n ,\n ]\n \n # sorting is stored\n table.options['sorted_by']\n {'Author': {'reverse': False}}\n \n # which is handy because...\n \n # tables can also be faceted (and options are copied to new tables)\n >>> for t in table.facet_by('Style'):\n ... print t.faceted_on\n ... t.table\n Minimalism\n [['Nicholson Baker', 'Mezannine', '150', 'Minimalism']]\n Modernism\n [['Samuel Beckett', 'Malone Muert', '120', 'Modernism'],\n ['James Joyce', 'Ulysses', '644', 'Modernism']]\n Satire\n [['Vladimir Sorokin', 'The Queue', '263', 'Satire']]\n\nHere's an [advanced example](https://gist.github.com/765321) that uses faceting and filtering to produce aggregates from [this spreadsheet](https://spreadsheets.google.com/ccc?key=0AprNP7zjIYS1dG5wbVJpWTVacWpUaUh5VHUxMk1wTEE&hl=en&authkey=CJfB5MYP) (extracted from the New York Times Congress API).\n\nFormatting\n----------\n\nFilters are just functions that take a value and some number of positional arguments.\nNew filters can be registered with the included Formatter class.\n\n >>> from table_fu.formatting import Formatter\n >>> format = Formatter()\n >>> def capitalize(value, *args):\n ... return str(value).capitalize()\n >>> format.register(capitalize)\n >>> print format('foo', 'capitalize')\n Foo\n \nCells can be formatted according to rules of the table (which carry over if the table is faceted):\n\n >>> table = TableFu(open('tests/sites.csv'))\n >>> table.columns\n ['Name', 'URL', 'About']\n >>> table.formatting = {\n ... 'Name': {'filter': 'link', 'args': ['URL']}\n ... }\n >>> print table[0]['Name']\n ChrisAmico.com\n \n \nHTML Output\n-----------\n\nTableFu can output an HTML table, using formatting you specify:\n\n >>> table = TableFu(open('tests/sites.csv'))\n >>> table.columns\n ['Name', 'URL', 'About']\n >>> table.formatting = {'Name': {'filter: 'link', 'args': ['URL']}}\n >>> table.columns = 'Name', 'About'\n >>> print table.html()\n \n \n \n \n \n \n \n \n \n
NameAbout
ChrisAmico.comMy personal site and blog
ProPublicaBuilders of the Ruby version of this library
PBS NewsHourWhere I spend my days
", "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/eyeseast/python-tablefu", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "python-tablefu", "package_url": "https://pypi.org/project/python-tablefu/", "platform": "any", "project_url": "https://pypi.org/project/python-tablefu/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/eyeseast/python-tablefu" }, "release_url": "https://pypi.org/project/python-tablefu/0.4.2/", "requires_dist": null, "requires_python": null, "summary": "A tool for manipulating spreadsheets and tables in Python, based on ProPublica's TableFu", "version": "0.4.2" }, "last_serial": 798102, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "f38f755e758f6aaa0bbb05c68fd65543", "sha256": "3ca62be8ec3baae3a00261f7ef372ed59a1b349c530b251f4f7a63eb4bcee10f" }, "downloads": -1, "filename": "python-tablefu-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f38f755e758f6aaa0bbb05c68fd65543", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 245354, "upload_time": "2010-12-28T21:57:04", "url": "https://files.pythonhosted.org/packages/2f/b5/c2362c8c0d9c08dfb2491a8a7f2287e3481e0c4dc157c7db50efc0f6f52d/python-tablefu-0.3.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "7bb43c1018aaa3fe3ea9996ce7905e3c", "sha256": "d9404d28c575fb8313eda87d303fd300c32fbffd9bef172f168ceb845177b808" }, "downloads": -1, "filename": "python-tablefu-0.3.0.zip", "has_sig": false, "md5_digest": "7bb43c1018aaa3fe3ea9996ce7905e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 249369, "upload_time": "2010-12-28T21:57:05", "url": "https://files.pythonhosted.org/packages/a6/9e/bf7bffbf56568733b4be5f2a2491b504f97625499954ffae3d6adfaf85bb/python-tablefu-0.3.0.zip" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "95d952383969cf7a4cca9513d92103cb", "sha256": "70ccda5e74122d9fcc709cccc6dc5809803e974af27e831484c73f7a3e74c728" }, "downloads": -1, "filename": "python-tablefu-0.4.0.tar.gz", "has_sig": false, "md5_digest": "95d952383969cf7a4cca9513d92103cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 246522, "upload_time": "2012-03-29T20:39:13", "url": "https://files.pythonhosted.org/packages/f1/0e/87d9ffac5a2488e959255c765ecb05117add65f44b4135b3cadbb2f31f8d/python-tablefu-0.4.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "62dcb4af132ee6e67dd828537892b64e", "sha256": "6657bff6b7db1f974e4c63f732ef001c6127087c4fcd52298cc8b67b18975312" }, "downloads": -1, "filename": "python-tablefu-0.4.0.zip", "has_sig": false, "md5_digest": "62dcb4af132ee6e67dd828537892b64e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 251320, "upload_time": "2012-03-29T20:39:16", "url": "https://files.pythonhosted.org/packages/98/c5/802a821b874a04ecfaa2d9b95c2fdc858b93674c81ccaf65e6f6d82799f6/python-tablefu-0.4.0.zip" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "0969460d83bc24432bf8031108703987", "sha256": "667df72dc977d900f9ba16e20ca6262045cff13f6acde351af99c3459298ce1f" }, "downloads": -1, "filename": "python-tablefu-0.4.1.tar.gz", "has_sig": false, "md5_digest": "0969460d83bc24432bf8031108703987", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 247424, "upload_time": "2012-03-30T02:54:32", "url": "https://files.pythonhosted.org/packages/5f/10/d7eaf52ab31976be613743693190c6047126b440959e2457233ce2ff4931/python-tablefu-0.4.1.tar.gz" }, { "comment_text": "", "digests": { "md5": "e2541f9c4b38bebf4391d2fca6b859e0", "sha256": "4263b9a440e86d92c8cd7d7f61cb00c0968477b2409d50df825ef0a2d087ab9f" }, "downloads": -1, "filename": "python-tablefu-0.4.1.zip", "has_sig": false, "md5_digest": "e2541f9c4b38bebf4391d2fca6b859e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 252389, "upload_time": "2012-03-30T02:54:34", "url": "https://files.pythonhosted.org/packages/00/6f/50d403fa55452b5f3166634bfe26629e82a3ce3e4a8b19d6f46f03c8c3e3/python-tablefu-0.4.1.zip" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "bf9017dca1d095cec15324a8ccc4c025", "sha256": "8de8091d031633fdc3c2cb1a5c986501116ad681a7347f305f1fec7b45803719" }, "downloads": -1, "filename": "python-tablefu-0.4.2.tar.gz", "has_sig": false, "md5_digest": "bf9017dca1d095cec15324a8ccc4c025", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 247445, "upload_time": "2012-04-22T20:53:48", "url": "https://files.pythonhosted.org/packages/21/37/7932aa140eb6a2d9d1e8ac7ba2430d93c847235ecef317d7ea371f5f3d3c/python-tablefu-0.4.2.tar.gz" }, { "comment_text": "", "digests": { "md5": "82a6b29ddd91b33b0fdece9415e679ab", "sha256": "e67c51438ea862a19bb91f62e30a5304864fa613daecc45ad79946b803a7f9ff" }, "downloads": -1, "filename": "python-tablefu-0.4.2.zip", "has_sig": false, "md5_digest": "82a6b29ddd91b33b0fdece9415e679ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 252429, "upload_time": "2012-04-22T20:53:49", "url": "https://files.pythonhosted.org/packages/fe/a3/77dfe0b23c09f5a87b34997c0eb415327efc59832c87090c0d3242cd7664/python-tablefu-0.4.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bf9017dca1d095cec15324a8ccc4c025", "sha256": "8de8091d031633fdc3c2cb1a5c986501116ad681a7347f305f1fec7b45803719" }, "downloads": -1, "filename": "python-tablefu-0.4.2.tar.gz", "has_sig": false, "md5_digest": "bf9017dca1d095cec15324a8ccc4c025", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 247445, "upload_time": "2012-04-22T20:53:48", "url": "https://files.pythonhosted.org/packages/21/37/7932aa140eb6a2d9d1e8ac7ba2430d93c847235ecef317d7ea371f5f3d3c/python-tablefu-0.4.2.tar.gz" }, { "comment_text": "", "digests": { "md5": "82a6b29ddd91b33b0fdece9415e679ab", "sha256": "e67c51438ea862a19bb91f62e30a5304864fa613daecc45ad79946b803a7f9ff" }, "downloads": -1, "filename": "python-tablefu-0.4.2.zip", "has_sig": false, "md5_digest": "82a6b29ddd91b33b0fdece9415e679ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 252429, "upload_time": "2012-04-22T20:53:49", "url": "https://files.pythonhosted.org/packages/fe/a3/77dfe0b23c09f5a87b34997c0eb415327efc59832c87090c0d3242cd7664/python-tablefu-0.4.2.zip" } ] }