Skip to main content

Jupyter/IPython Extension for Sparql Pandas dataframe queries

Project description

IPython Sparql Pandas Extension

Jupyter/IPython Extension for Sparql Pandas dataframe queries.

Install

Via pip:

pip install ipython-sparql-pandas

Usage

Load the extension:

%load_ext ipython_sparql_pandas

Query:

%%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:

foo.plot.barh('name', 'populationTotal').invert_yaxis()

plot

Acknowledgements

This package is inspired by ipython_sparql.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipython_sparql_pandas-1.6.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

ipython_sparql_pandas-1.6-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ipython_sparql_pandas-1.6.tar.gz.

File metadata

  • Download URL: ipython_sparql_pandas-1.6.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.0

File hashes

Hashes for ipython_sparql_pandas-1.6.tar.gz
Algorithm Hash digest
SHA256 03423d7c57fa3a4c427670fa6f99c2a4ee90ffb04094abf8cc784c5ac0e0f3bd
MD5 c928e8cd7960158f95c9048942764012
BLAKE2b-256 0965b13ad35357a386b1539e2d3bb94a8255e2c1bc7683dd48e94625f5fbaa9b

See more details on using hashes here.

File details

Details for the file ipython_sparql_pandas-1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ipython_sparql_pandas-1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c9f56b86380bb1bbd7697e4af2de3d11aba2fd1743700270d1ef5f50eaf267b3
MD5 e5d2203effc137ff68dc874820ef01cd
BLAKE2b-256 be69cda6d276c9e45e69e8288798447d61a88e7d6619333b542bc4f9077942f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page