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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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