all problems

Fare per mile by city PRO

pandasmediumgroupbyratios

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

trips = pd.DataFrame({
    "trip_id": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    "driver": ["alex", "alex", "sam", "sam", "alex", "jordan", "jordan", "sam", "alex", "jordan"],
    "city": ["SF", "SF", "NYC", "NYC", "SF", "LA", "LA", "NYC", "SF", "LA"],
    "fare": [12.5, 8.0, 20.0, 15.0, 9.5, 18.0, 22.0, 11.0, 14.0, 16.5],
    "surge": [1.0, 1.0, 1.5, 1.2, 1.0, 2.0, 1.5, 1.0, 1.3, 1.8],
    "distance": [3.2, 2.1, 5.5, 4.0, 2.8, 6.0, 7.2, 3.5, 3.8, 5.0],
})

This is a Pro problem

“Fare per mile by city” is part of the Pro problem set. Upgrade to unlock the harder half of every track — SQL, Python and pandas.

Upgrade to Pro

The first problems in each track stay free.