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.

Challenge: Selecting and manipulating data

Challenge: Selecting and manipulating data

From the course: Faster pandas

Start my 1-month free trial

Challenge: Selecting and manipulating data

(bright upbeat music) - We have a code, to find out when was the last error in our logs. So we initialized last time to nothing. Go over the rows in the data frame. If there was no error we continue. Otherwise, if it's the first time or the current time is bigger than the last time we update the last time and finally we return the last time. And we also have a utility function to load the data frame. Let's see how much time it takes. So ipython and then we're going to do, run off last error and then df equal load df from logs.db. And we're going to time it. So time it, last error time of df. This takes about two seconds. Make this code faster by using boolean indexing and new funds.

Contents