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.2.tar.gz (3.6 kB view hashes)

Uploaded source

Built Distribution

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

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page