{ "info": { "author": "Yannis Katsaros", "author_email": "yanniskatsaros@hotmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "

\n \n

\n\n# Overview\n`faro` is a wrapper for the Python SQLite API, and aims to be a SQL-driven data analysis library for Python. It is intended to complement the existing data analysis packages in the Python eco-system, such as `numpy` and `pandas`. With `faro` you can use pure SQL to work with a collection of table objects in memory and easily interoperate with `numpy` and `pandas` when needed. Lastly, `faro` plays nicely with `IPython` so you can easily interact and explore your query results.\n\n# Usage\nCreate a `Database` object and give it a name.\n```python\nfrom faro import Database\n\ndb = Database('transportation')\n```\n\nTo add tables to the in-memory database, simply specify the name of the file. Supported file types include: `csv`, `json`, and `xlsx`. `add_table` inserts the contents of a file into a new table within the database. It can automatically detect the filetype and parse the file contents accordingly. In this example we load two different tables, one in `csv` format, and the other in `json` format.\n```python\ndb.add_table('cars.json', name='cars')\ndb.add_table('airports.csv', name='airports')\n```\n\nWe can also directly pass `pandas.DataFrame` or `faro.Table` objects to be added to the database. A helpful pattern when dealing with more complex parsing for a specific file is to read it into memory using `pandas` then add the `DataFrame` to the `faro.Database`.\n```python\nbuses = pd.DataFrame({\n 'id' : [1, 2, 3, 4, 5],\n 'from' : ['Houston', 'Atlanta', 'Chicago', 'Boston', 'New York'],\n 'to' : ['San Antonio', 'Charlotte', 'Milwaukee', 'Cape Cod', 'Buffalo']\n})\n\ndb.add_table(buses, name='buses')\n```\n\nWe can now query against any table in the database using pure SQL, and easily interact with the results in a Jupyter Notebook.\n```python\nsql = \"\"\"\nSELECT iata,\n name,\n city,\n state\n FROM airports\n WHERE country = 'USA'\n LIMIT 5\n\"\"\"\ndb.query(sql)\n```\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
iatanamecitystate
000MThigpenBay SpringsMS
100RLivingston MunicipalLivingstonTX
200VMeadow LakeColorado SpringsCO
301GPerry-WarsawPerryNY
401JHilliard AirparkHilliardFL
\n\nIf we want to interact with the data returned by the query, we can easily transform it into whatever data type is most convenient for the situation. Supported type conversions include: `List[Tuple]`, `Dict[List]`, `numpy.ndarray`, and `pandas.DataFrame`.\n\n```python\ntable = db.query(sql)\ntype(table)\n>>> faro.table.Table\n\ndf = table.to_dataframe()\ntype(df)\n>>> pandas.core.frame.DataFrame\n\nmatrix = table.to_numpy()\ntype(matrix)\n>>> numpy.ndarray\n```\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": "http://github.com/yanniskatsaros/faro", "keywords": "sql sqlite sqlite3 database data-science data-analysis python", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "faro", "package_url": "https://pypi.org/project/faro/", "platform": "", "project_url": "https://pypi.org/project/faro/", "project_urls": { "Homepage": "http://github.com/yanniskatsaros/faro" }, "release_url": "https://pypi.org/project/faro/0.0.2/", "requires_dist": [ "pandas" ], "requires_python": "", "summary": "An SQL-focused data analysis library for Python.", "version": "0.0.2" }, "last_serial": 5657644, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "396f27afc2e19e8d8305b40fb01bfed4", "sha256": "2db2c7af9932ffe4f30b89163c46aa4df78f3e0b7c7aac92e359bb52a791b627" }, "downloads": -1, "filename": "faro-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "396f27afc2e19e8d8305b40fb01bfed4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6360, "upload_time": "2019-08-09T20:01:58", "url": "https://files.pythonhosted.org/packages/af/f0/3a74e0514c1889cf7adad91d256fd2b3369c4c3f948e4f8d9147439e7b26/faro-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb93a0ce70c45413a594c85a1e7786ee", "sha256": "83eca8a4b13028ba92a55f4b9f6e27a1aa0be4d18818aff0eab7af7e61061aa4" }, "downloads": -1, "filename": "faro-0.0.1.tar.gz", "has_sig": false, "md5_digest": "eb93a0ce70c45413a594c85a1e7786ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5320, "upload_time": "2019-08-09T20:02:01", "url": "https://files.pythonhosted.org/packages/ab/de/9aafc0a90b4ab4a729f00721d91628660a0200e7ef83e9d749c24a752526/faro-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "02def8bc3735a20e5bd065ce88b000ec", "sha256": "a1c09a416e17a3f9cde1f18c9c782ce4a10c53876aa120506b414f2327bc9c21" }, "downloads": -1, "filename": "faro-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "02def8bc3735a20e5bd065ce88b000ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6381, "upload_time": "2019-08-09T20:23:22", "url": "https://files.pythonhosted.org/packages/01/53/f7b9c876b7d58ce9bdb451137d5275332c74106df4ab70be3fb18c71a3b1/faro-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8cb221fc378322b521219ac77e9969b0", "sha256": "8cd2dccee15fb43911eafcd95570d893020a404a010c321fc595c7482036e65b" }, "downloads": -1, "filename": "faro-0.0.2.tar.gz", "has_sig": false, "md5_digest": "8cb221fc378322b521219ac77e9969b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5338, "upload_time": "2019-08-09T20:23:25", "url": "https://files.pythonhosted.org/packages/9b/4b/57d957ff6ded96dce8b74e77118586f96c1d2e98a7428fb27b4a7e006d11/faro-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "02def8bc3735a20e5bd065ce88b000ec", "sha256": "a1c09a416e17a3f9cde1f18c9c782ce4a10c53876aa120506b414f2327bc9c21" }, "downloads": -1, "filename": "faro-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "02def8bc3735a20e5bd065ce88b000ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6381, "upload_time": "2019-08-09T20:23:22", "url": "https://files.pythonhosted.org/packages/01/53/f7b9c876b7d58ce9bdb451137d5275332c74106df4ab70be3fb18c71a3b1/faro-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8cb221fc378322b521219ac77e9969b0", "sha256": "8cd2dccee15fb43911eafcd95570d893020a404a010c321fc595c7482036e65b" }, "downloads": -1, "filename": "faro-0.0.2.tar.gz", "has_sig": false, "md5_digest": "8cb221fc378322b521219ac77e9969b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5338, "upload_time": "2019-08-09T20:23:25", "url": "https://files.pythonhosted.org/packages/9b/4b/57d957ff6ded96dce8b74e77118586f96c1d2e98a7428fb27b4a7e006d11/faro-0.0.2.tar.gz" } ] }