From the course: Faster pandas

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Join and query

Solution: Join and query

From the course: Faster pandas

Start my 1-month free trial

Solution: Join and query

(lively music) - [Instructor] Let's have a look at solution. We input pandas below the bike DataFrame and then we load the kiosk DataFrame, setting the index from the kiosk ID column. And then we're merging the two DataFrames, the left on the checkout kiosk ID and the right on the index. Now that we have the merged DataFrame, we're going to query to get the active 2017 DataFrame. Where the kiosk status is active, the year is 2017. The trip duration minutes is bigger than zero. And finally, we're going to print the median of the trip duration minutes column in this DataFrame, python median_duration.py. And it's 16 minutes.

Contents