# IPython Sparql Pandas Extension
Jupyter/IPython Extension for Sparql Pandas dataframe queries.
## Install
Via pip:
```bash
pip install ipython-sparql-pandas
```
## Usage
Load the extension:
```
%load_ext ipython_sparql_pandas
```
Query:
```sparql
%%sparql http://dbpedia.org/sparql/ -qs foo
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcb: <http://dbpedia.org/resource/Category:>
PREFIX dbp: <http://dbpedia.org/property/>
SELECT DISTINCT ?name ?capital ?populationTotal WHERE {
?capital dct:subject dcb:Capitals_in_Europe ;
dbp:populationTotal ?populationTotal ;
foaf:name ?name.
}
ORDER BY DESC(?populationTotal)
LIMIT 5
```
The variable `foo` is now a Pandas dataframe of SPARQL results:
```python
foo.plot.barh('name', 'populationTotal').invert_yaxis()
```
![plot](https://raw.githubusercontent.com/bennokr/ipython_sparql_pandas/main/plot.png)
## Acknowledgements
This package is inspired by [ipython_sparql](https://github.com/baito/ipython_sparql).
Raw data
{
"_id": null,
"home_page": "https://github.com/bennokr/ipython_sparql_pandas",
"name": "ipython-sparql-pandas",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "sparql, ipython, jupyter extension, magics, ipython, pandas",
"author": "Benno Kruit",
"author_email": "b.b.kruit@vu.nl",
"download_url": "https://files.pythonhosted.org/packages/09/65/b13ad35357a386b1539e2d3bb94a8255e2c1bc7683dd48e94625f5fbaa9b/ipython_sparql_pandas-1.6.tar.gz",
"platform": null,
"description": "# IPython Sparql Pandas Extension\n\nJupyter/IPython Extension for Sparql Pandas dataframe queries.\n\n## Install\nVia pip:\n\n```bash\npip install ipython-sparql-pandas\n```\n\n## Usage\n\nLoad the extension:\n\n```\n%load_ext ipython_sparql_pandas\n```\n\nQuery:\n\n```sparql\n%%sparql http://dbpedia.org/sparql/ -qs foo\nPREFIX dct: <http://purl.org/dc/terms/>\nPREFIX dcb: <http://dbpedia.org/resource/Category:>\nPREFIX dbp: <http://dbpedia.org/property/>\n\nSELECT DISTINCT ?name ?capital ?populationTotal WHERE {\n ?capital dct:subject dcb:Capitals_in_Europe ;\n dbp:populationTotal ?populationTotal ; \n foaf:name ?name. \n}\nORDER BY DESC(?populationTotal)\nLIMIT 5\n```\n\nThe variable `foo` is now a Pandas dataframe of SPARQL results:\n\n```python\nfoo.plot.barh('name', 'populationTotal').invert_yaxis()\n```\n\n![plot](https://raw.githubusercontent.com/bennokr/ipython_sparql_pandas/main/plot.png)\n\n## Acknowledgements\nThis package is inspired by [ipython_sparql](https://github.com/baito/ipython_sparql).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Jupyter/IPython Extension for Sparql Pandas dataframe queries",
"version": "1.6",
"project_urls": {
"Bug Tracker": "https://github.com/bennokr/ipython_sparql_pandas/issues",
"Homepage": "https://github.com/bennokr/ipython_sparql_pandas"
},
"split_keywords": [
"sparql",
" ipython",
" jupyter extension",
" magics",
" ipython",
" pandas"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "be69cda6d276c9e45e69e8288798447d61a88e7d6619333b542bc4f9077942f4",
"md5": "e5d2203effc137ff68dc874820ef01cd",
"sha256": "c9f56b86380bb1bbd7697e4af2de3d11aba2fd1743700270d1ef5f50eaf267b3"
},
"downloads": -1,
"filename": "ipython_sparql_pandas-1.6-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5d2203effc137ff68dc874820ef01cd",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 4020,
"upload_time": "2024-06-17T10:39:25",
"upload_time_iso_8601": "2024-06-17T10:39:25.956495Z",
"url": "https://files.pythonhosted.org/packages/be/69/cda6d276c9e45e69e8288798447d61a88e7d6619333b542bc4f9077942f4/ipython_sparql_pandas-1.6-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0965b13ad35357a386b1539e2d3bb94a8255e2c1bc7683dd48e94625f5fbaa9b",
"md5": "c928e8cd7960158f95c9048942764012",
"sha256": "03423d7c57fa3a4c427670fa6f99c2a4ee90ffb04094abf8cc784c5ac0e0f3bd"
},
"downloads": -1,
"filename": "ipython_sparql_pandas-1.6.tar.gz",
"has_sig": false,
"md5_digest": "c928e8cd7960158f95c9048942764012",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3709,
"upload_time": "2024-06-17T10:39:28",
"upload_time_iso_8601": "2024-06-17T10:39:28.708236Z",
"url": "https://files.pythonhosted.org/packages/09/65/b13ad35357a386b1539e2d3bb94a8255e2c1bc7683dd48e94625f5fbaa9b/ipython_sparql_pandas-1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-17 10:39:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bennokr",
"github_project": "ipython_sparql_pandas",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ipython-sparql-pandas"
}