Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

alt text

Open Data Blend for Python

Open Data Blend for Python is the fastest way to get data from the Open Data Blend Dataset API. It is a lightweight, easy-to-use extract and load (EL) tool.

The get_data function will only download a data file if the requested version does not already exist in the local cache. It also saves a copy of the dataset metadata (datapackage.json) for future use. You can learn about how we version our datasets in the Open Data Blend Docs.

After downloading the data and metadata files, get_data returns an object called Output which contains the local paths of the files. From there, you can load the data in Pandas, Koalas, or something similar to begin your analysis or feature engineering.

Installation

Install the latest version of opendatablend from PyPI:

pip install opendatablend

Usage Examples

The following examples require the pandas and pyarrow packages to be installed:

pip install pandas
pip install pyarrow

Making Public API Requests

Note: Public API requests are limited per month.

Get The Data

import opendatablend as odb
import pandas as pd

dataset_path = 'https://packages.opendatablend.io/v1/open-data-blend-road-safety/datapackage.json'

# Specify the resource name of the data file. In this example, the 'date' data file will be requested in .parquet format.
resoure_name = 'date-parquet'

# Get the data and store the output object
output = odb.get_data(dataset_path, resource_name)

# Print the file locations
print(output.data_file_name)
print(output.metadata_file_name)

Use The Data

# Read a subset of the columns into a dataframe
df_date = pd.read_parquet(output.data_file_name, columns=['drv_date_key', 'drv_date', 'drv_month_name', 'drv_month_number', 'drv_quarter_name', 'drv_quarter_number', 'drv_year'])

# Check the contents of the dataframe
df_date

Making Authenticated API Requests

Get The Data

import opendatablend as odb
import pandas as pd

dataset_path = 'https://packages.opendatablend.io/v1/open-data-blend-road-safety/datapackage.json'
access_key = '<ACCESS_KEY_HERE>'

# Specify the resource name of the data file. In this example, the 'date' data file will be requested in .parquet format.
resoure_name = 'date-parquet'

# Get the data and store the output object
output = odb.get_data(dataset_path, resource_name, access_key=access_key)

# Print the file locations
print(output.data_file_name)
print(output.metadata_file_name)

Use The Data

# Read a subset of the columns into a dataframe
df_date = pd.read_parquet(output.data_file_name, columns=['drv_date_key', 'drv_date', 'drv_month_name', 'drv_month_number', 'drv_quarter_name', 'drv_quarter_number', 'drv_year'])

# Check the contents of the dataframe
df_date

Additional Examples

For more in-depth examples, see the examples folder.

Download files

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

Source Distribution

opendatablend-0.3.0rc3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opendatablend-0.3.0rc3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file opendatablend-0.3.0rc3.tar.gz.

File metadata

  • Download URL: opendatablend-0.3.0rc3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

File hashes

Hashes for opendatablend-0.3.0rc3.tar.gz
Algorithm Hash digest
SHA256 a163a9c948bff75a1a68069aec8efcccd7b73061314d891689def63d6626ca44
MD5 129464eaa3e85d43c4bf7a356d4be87f
BLAKE2b-256 2d68435343d7dfa654098ea1d707c44bbdeefb1f71fa517305bc20ee6fb57f78

See more details on using hashes here.

File details

Details for the file opendatablend-0.3.0rc3-py3-none-any.whl.

File metadata

  • Download URL: opendatablend-0.3.0rc3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

File hashes

Hashes for opendatablend-0.3.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 d3da687fc8b0b209868d1ff5c525de08c3fba8827d02931933492f8b3421f4d0
MD5 6e7e7dea9079666178d251ada2d55c84
BLAKE2b-256 cb31067595afc890189b445bf89f07b7234f53269fd5e86039880739363a145e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.3.0rc3 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page