Skip to main content

Divvy Rideshare Data

Overview

Access and work with Chicago rideshare data from Python.

All the information is derived from the official divvy bikes website: https://divvybikes.com/

Where the data sources were linked to: https://ride.divvybikes.com/system-data

which point to:

Installation

Install from pip

$ pip install python-divvy

Usage

Reading Data

Reading from the various data sources can be done with the following functions.

import divvy

# Historical trips between a given date range
df_trips = divvy.read_historical_trips(
    start_date="2021-01-01", 
    end_date="2021-02-01"
)
# The trips from July 15th 2022 until latest
df_trips = divvy.read_historical_trips(start_date="2022-07-15")

# Available ebikes and scooters
df_available = divvy.read_available()

# Station information and bikes and scooters available there 
df_stations = divvy.read_stations()

With the install of geopandas, the pre-May 2022 pricing boundary for ebikes can be accessed with the read_fee_boundary function.

# Single row geopandas.GeoDataFrame
gdf_fees = divvy.read_fee_boundary()

Trip Pricing

This package allows provides access to the latest pricing for the different bikes as defined here. These prices can be apply to pandas.Series objects as follows:

df_trips = pd.DataFrame({
    "duration_in_mins": [10, 10, 10, 10], 
    "member": [True, True, False, False], 
    "electric_bike": [True, False, True, False], 
})

df_trips["price"] = divvy.apply_pricing(
    duration=df_trips["duration_in_mins"], 
    member=df_trips["member"], 
    electric_bike=df_trips["electric_bike"], 
)

Classic bike prices for casual users are ambiguous due to the daily rate or single trip rate. However, they can be accessed in the divvy.pricing module as so.

casual_non_electric_duration = [10, 20, 30]

divvy.pricing.single_ride_rate(casual_non_electric_duration)
divvy.pricing.visitor_pass_rate(casual_non_electric_duration)

New pricing can easily be defined from the divvy.pricing module as well. For instance, a reduced ebike rate can be created for casual users.

reduced_ebike_rate = (
    divvy.pricing.UnlockRate(amount=100) 
    + divvy.pricing.MinuteRate(amount=25, start=0)
)

casual_electric_duration = [10, 20, 30]

reduced_ebike_rate(casual_electric_duration)

Metadata

Release files for python-divvy 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-divvy 0.0.5
File Size Uploaded
python-divvy-0.0.5.tar.gz 8.8 kB Details

Release files / python-divvy-0.0.5.tar.gz

Download URL python-divvy-0.0.5.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0a45c8d87571ead8f637c0bd49271f166de1281c90ff64f5114d48f1eaf07df6
BLAKE2b-256 checksum
How to use checksums
ecfbf1f9bb649c7540729206be84874440529a78711b95abc2261325f58dee0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

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