Get a Pandas dataframe from SPARQL queries
Project description
title: sparqldataframe
A Python library that can send SPARQL queries to a SPARQL endpoint and retrieve a Pandas dataframe from the result.
Installation
pip install sparqldataframe
Usage
Here is an example how to run a SPARQL query on the Wikidata endpoint:
import sparqldataframe
sparql_query = """
SELECT ?item ?itemLabel
WHERE {
?item wdt:P31 wd:Q146.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
"""
df = sparqldataframe.query("https://query.wikidata.org/sparql", sparql_query)
Wikidata and DBPedia can be both used without
adding the SPARQL endpoint url by using the wikidata_query()
and
dbpedia_query()
functions respectively:
df = sparqldataframe.wikidata_query(sparql_query)
df = sparqldataframe.dbpedia_query(sparql_query)
License
This project is licensed under the MIT license. See the LICENSE for details.
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
sparqldataframe-0.1.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for sparqldataframe-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd3be6db7b69bdfdf70598add12e2f9d9d06dd5a6fc39bb7ecb272883bfa1e9f |
|
MD5 | f5fb3c6ce8ab12e7529ea87b55e23572 |
|
BLAKE2b-256 | c90808ceef21f69da227e207dcee83925d3485260f10a69952eefbebda8079d5 |