Skip to main content

Utility package for easily turning a SPARQL query into a dataframe

Project description

wikidata2df

https://img.shields.io/pypi/v/wikidata2df.svg https://img.shields.io/travis/jvfe/wikidata2df.svg Documentation Status

Utility package for easily turning a SPARQL query into a dataframe

Ever wished you could easily and programatically get data from Wikidata into a nice and analysable Pandas DataFrame? Well, this package solves that problem: With a single function you can turn your SPARQL query into a pandas DataFrame, without having to deal with the messy JSON intermediate.

Basic Usage

To install:

$ pip install wikidata2df
from wikidata2df import wikidata2df

# A SPARQL query to return all cats in Wikidata!

cat_query = """
#Cats
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P31 wd:Q146.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
"""

cats_dataframe = wikidata2df(cat_query) # Returns a Pandas DataFrame

Alternatives

  • Maybe you want more sofisticated functions? Or a way to edit Wikidata programatically? Awesome!

  • Would you rather use R? That’s cool too!

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2020-08-08)

  • First release on PyPI.

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

wikidata2df-0.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

wikidata2df-0.1.0-py2.py3-none-any.whl (5.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wikidata2df-0.1.0.tar.gz.

File metadata

  • Download URL: wikidata2df-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for wikidata2df-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a9440162388bfcdac49ac7f9013df5bc6088b635af958ef277fe56a65295ae6
MD5 1866cacf9319e58288c434234405fcd0
BLAKE2b-256 664f8a35f641c0d5263d06ba3bffadcb501cc1d8b5956663c0f58e6835a9879a

See more details on using hashes here.

File details

Details for the file wikidata2df-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: wikidata2df-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for wikidata2df-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 39bb127e2909f642bda2e1f037b990aed6cc069d6bd62cfdffeec1e1bc3f769d
MD5 d5a8bbd61e9ad3e71ac09075495b80ff
BLAKE2b-256 d93103cffaee1bca02c503bcee5f94dbd3453f4951d7f2bd52088da2b75a4517

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