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.

Using built-in functions

Using built-in functions

From the course: Faster pandas

Start my 1-month free trial

Using built-in functions

- [Narrator] Let's load the Austin Bike dataset. So, ipython and import pandas as pd and then df = pd.read csv, the Austin Bike dataset, and we're going to say the low memory equal false. And now let's find out the maximal ride duration, so max of df dot Trip Duration Minutes, and this seems a bit much. In days, we can take out 3 and divide it by 24 times 60, which is 23 days. It's a good reminder to clean your data before working on it. Back to the Maximal Ride Duration. Pandas series offers a max method as well. So, df, Trip Duration Minutes dot max. And let's compare them both. So the built-in max, we're going to do time it, and we're going to time it the max method. So we got 37.5 milliseconds versus 307 microseconds. So three, seven, five, zero, zero divided by three, oh, seven, and it's about 122 times faster. Pandas provides many more functions, and chances are you'll find the function you need already implemented in Pandas. If you need to squeeze a bit more performance, you…

Contents