Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Convert SPARQL results to Pandas dataframes

Project description

sparql-dataframe

Helper to convert SPARQLWrapper results to Pandas dataframes.

Build Status

See this blog post for examples. You might also be interested in these related examples from Su Labs tutorial.

Install

Directly from PyPi for Python 3.4+.

$ pip install sparql-dataframe

From Github. This should support Python 2.7 as well.

$ pip install git+https://github.com/lawlesst/sparql-dataframe.git

Usage

import sparql_dataframe

endpoint = "http://dbpedia.org/sparql"

q = """
    SELECT ?label ?wikiPageID
    WHERE {
    <http://dbpedia.org/resource/Baseball> rdfs:label ?label ;
         <http://dbpedia.org/ontology/wikiPageID> ?wikiPageID
    }
"""

df = sparql_dataframe.get(endpoint, q)
...

By default, the query will be passed to the server as a GET request. To pass the query to the server as a POST request, use the post=True keyword.

df = sparql_dataframe.get(endpoint, q, post=True)

Tests

$ python -m unittest

Project details


Download files

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

Files for sparql-dataframe, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size sparql_dataframe-0.3-py3-none-any.whl (3.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size sparql_dataframe-0.3.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page