{ "info": { "author": "S. Andrew Sheppard", "author_email": "andrew@wq.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: GIS", "Topic :: Text Processing :: Markup :: XML", "Topic :: Utilities" ], "description": "**IterTable** is a Pythonic API for iterating through tabular data formats, including CSV, XLS, XML, and JSON.\n\n```python\nfrom itertable import load_file\n\nfor row in load_file(\"example.xls\"):\n print(row.date, row.name)\n```\n\n[![Latest PyPI Release](https://img.shields.io/pypi/v/itertable.svg)](https://pypi.org/project/itertable)\n[![Release Notes](https://img.shields.io/github/release/wq/itertable.svg)](https://github.com/wq/itertable/releases)\n[![License](https://img.shields.io/pypi/l/itertable.svg)](https://github.com/wq/itertable/blob/master/LICENSE)\n[![GitHub Stars](https://img.shields.io/github/stars/wq/itertable.svg)](https://github.com/wq/itertable/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/wq/itertable.svg)](https://github.com/wq/itertable/network)\n[![GitHub Issues](https://img.shields.io/github/issues/wq/itertable.svg)](https://github.com/wq/itertable/issues)\n\n[![Travis Build Status](https://img.shields.io/travis/wq/itertable.svg)](https://travis-ci.org/wq/itertable)\n[![Python Support](https://img.shields.io/pypi/pyversions/itertable.svg)](https://pypi.python.org/pypi/itertable)\n\n> **Note:** Prior to version 2.0, IterTable was **wq.io**, a submodule of the [wq framework]. The package has been renamed to avoid confusion with the wq framework website ().\nSimilarly, IterTable's `*IO` classes have been renamed to `*Iter`, as the API is not intended to match that of Python's `StringIO` or other `io` classes.\n\n```diff\n- from wq.io import CsvFileIO\n- data = CsvFileIO(filename='data.csv')\n+ from itertable import CsvFileIter\n+ data = CsvFileIter(filename='data.csv')\n```\n\n## Getting Started\n\n```bash\n# Recommended: create virtual environment\n# python3 -m venv venv\n# . venv/bin/activate\n\npython3 -m pip install itertable\n\n# GIS support (Fiona & Shapely)\npython3 -m pip install itertable[gis]\n\n# Excel write support\npython3 -m pip install itertable[write]\n# (xls/xlsx read support is enabled by default)\n\n# Pandas integration\npython3 -m pip install itertable[pandas]\n```\n\n## Overview\n\nIterTable provides a general purpose API for loading, iterating over, and writing tabular datasets. The goal is to avoid needing to remember the unique usage of e.g. [csv], [xlrd], or [xml.etree] every time one needs to work with external data. Instead, IterTable abstracts these libraries into a consistent interface that works as an [iterable] of [namedtuples]. Whenever possible, the field names for a dataset are automatically determined from the source file, e.g. the column headers in an Excel spreadsheet.\n\n```python\nfrom itertable import ExcelFileIter\ndata = ExcelFileIter(filename='example.xls')\nfor row in data:\n print(row.name, row.date)\n```\n\nIterTable provides a number of built-in classes like the above, including a `CsvFileIter`, `XmlFileIter`, and `JsonFileIter`. There is also a convenience function, `load_file()`, that attempts to automatically determine which class to use for a given file.\n\n```python\nfrom itertable import load_file\ndata = load_file('example.csv')\nfor row in data:\n print(row.name, row.date)\n```\n\nAll of the included `*FileIter` classes support both reading and writing to external files, though write support for Excel files requires `itertable[write]` (which installs `xlwt` and `xlswriter`).\n\n### Network Client\n\nIterTable also provides network-capable equivalents of each of the above classes, to facilitate loading data from third party webservices.\n\n```python\nfrom itertable import JsonNetIter\nclass WebServiceIter(JsonNetIter):\n url = \"http://example.com/api\"\n\ndata = WebServiceIter(params={'type': 'all'})\nfor row in data:\n print(row.timestamp, row.value)\n```\n\nThe powerful [requests] library is used internally to load data over HTTP.\n\n### Pandas Analysis\n\nWhen [Pandas] is installed (via `itertable[pandas]`), the `as_dataframe()` method on itertable classes can be used to create a [DataFrame], enabling more extensive analysis possibilities.\n\n```python\ninstance = WebServiceIter(params={'type': 'all'})\ndf = instance.as_dataframe()\nprint(df.value.mean())\n```\n\n### GIS Support\n\nWhen [Fiona] and [Shapely] are installed (via `itertable[gis]`), itertable can also open and create shapefiles and other OGR-compatible geographic data formats.\n\n```python\nfrom itertable import ShapeIter\ndata = ShapeIter(filename='sites.shp')\nfor id, site in data.items():\n print(id, site.geometry.wkt)\n```\n\nMore information on IterTable's gis support is available [here][gis].\n\n### Extending IterTable\n\nIt is straightforward to [extend IterTable][custom] to support arbitrary formats. Each provided class is composed of a [BaseIter][base] class and mixin classes ([loaders], [parsers], and [mappers]) that handle the various steps of the process.\n\n[wq framework]: https://wq.io/\n[csv]: https://docs.python.org/3/library/csv.html\n[xlrd]: http://www.python-excel.org/\n[xml.etree]: https://docs.python.org/3/library/xml.etree.elementtree.html\n[iterable]: https://docs.python.org/3/glossary.html#term-iterable\n[namedtuples]: https://docs.python.org/3/library/collections.html#collections.namedtuple\n[requests]: http://python-requests.org/\n[xlwt]: http://www.python-excel.org/\n[xlsxwriter]: https://xlsxwriter.readthedocs.org/\n[Pandas]: http://pandas.pydata.org/\n[DataFrame]: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html\n[Fiona]: https://github.com/Toblerity/Fiona\n[Shapely]: https://github.com/Toblerity/Shapely\n\n[custom]: https://github.com/wq/itertable/blob/master/docs/about.md\n[base]: https://github.com/wq/itertable/blob/master/docs/base.md\n[loaders]: https://github.com/wq/itertable/blob/master/docs/loaders.md\n[parsers]: https://github.com/wq/itertable/blob/master/docs/parsers.md\n[mappers]: https://github.com/wq/itertable/blob/master/docs/mappers.md\n[gis]: https://github.com/wq/itertable/blob/master/docs/gis.md\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wq/itertable", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "itertable", "package_url": "https://pypi.org/project/itertable/", "platform": "", "project_url": "https://pypi.org/project/itertable/", "project_urls": { "Homepage": "https://github.com/wq/itertable" }, "release_url": "https://pypi.org/project/itertable/2.0.0b1/", "requires_dist": [ "requests", "xlrd", "click", "Fiona ; extra == 'gis'", "geopandas ; extra == 'gis'", "pandas ; extra == 'pandas'", "xlwt ; extra == 'write'", "xlsxwriter ; extra == 'write'" ], "requires_python": "", "summary": "Iterable API for tabular datasets including CSV, XLS, XML, & JSON.", "version": "2.0.0b1" }, "last_serial": 5882591, "releases": { "2.0.0b1": [ { "comment_text": "", "digests": { "md5": "7b6988634aea101634e5c620b9a92118", "sha256": "58b0e2ada09bd6cdc12fa836014c953187911bc7b50ecb4d5bac4de0da41430f" }, "downloads": -1, "filename": "itertable-2.0.0b1-py3-none-any.whl", "has_sig": false, "md5_digest": "7b6988634aea101634e5c620b9a92118", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20932, "upload_time": "2019-09-25T01:13:38", "url": "https://files.pythonhosted.org/packages/0d/5d/f8d6ad58ddcb4552efcb6f05370a80731fbeb034ff8fc317e3faf1ea2515/itertable-2.0.0b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8435728ac6692385f742158183a06197", "sha256": "816de3af715758a40fdb33a043644eebe00002627b6a22fdff7067d8cf03520c" }, "downloads": -1, "filename": "itertable-2.0.0b1.tar.gz", "has_sig": false, "md5_digest": "8435728ac6692385f742158183a06197", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45988, "upload_time": "2019-09-25T01:13:44", "url": "https://files.pythonhosted.org/packages/d9/7a/0878239f7b29231cf40578cd9af018d108ca27b9ddce424f20585f5ed76d/itertable-2.0.0b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7b6988634aea101634e5c620b9a92118", "sha256": "58b0e2ada09bd6cdc12fa836014c953187911bc7b50ecb4d5bac4de0da41430f" }, "downloads": -1, "filename": "itertable-2.0.0b1-py3-none-any.whl", "has_sig": false, "md5_digest": "7b6988634aea101634e5c620b9a92118", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20932, "upload_time": "2019-09-25T01:13:38", "url": "https://files.pythonhosted.org/packages/0d/5d/f8d6ad58ddcb4552efcb6f05370a80731fbeb034ff8fc317e3faf1ea2515/itertable-2.0.0b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8435728ac6692385f742158183a06197", "sha256": "816de3af715758a40fdb33a043644eebe00002627b6a22fdff7067d8cf03520c" }, "downloads": -1, "filename": "itertable-2.0.0b1.tar.gz", "has_sig": false, "md5_digest": "8435728ac6692385f742158183a06197", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45988, "upload_time": "2019-09-25T01:13:44", "url": "https://files.pythonhosted.org/packages/d9/7a/0878239f7b29231cf40578cd9af018d108ca27b9ddce424f20585f5ed76d/itertable-2.0.0b1.tar.gz" } ] }