Course Content
Dealing with Dates and Times in Python
Dealing with Dates and Times in Python
Challenge: Extreme Trips Durations
Now we have the respective columns converted into the correct type. It means now we can manipulate them using the learned methods.
We already have column trip_duration
in our dataset, so why do we need to work with datetime
objects? Yes, we have, but this number is in seconds, which is not readable at all (since there are 60 seconds in one minute, not 100). Let's see if there are outliers in our dataset.
Task
- Create new column
duration
indf
dataframe and save the result of subtractingdropoff_datetime
andpickup_datetime
columns. - Sort the entire dataframe by newly created column in descending order. Save it in
df_sort
. - Print the top-5 longest and shortest trips.
Thanks for your feedback!
Challenge: Extreme Trips Durations
Now we have the respective columns converted into the correct type. It means now we can manipulate them using the learned methods.
We already have column trip_duration
in our dataset, so why do we need to work with datetime
objects? Yes, we have, but this number is in seconds, which is not readable at all (since there are 60 seconds in one minute, not 100). Let's see if there are outliers in our dataset.
Task
- Create new column
duration
indf
dataframe and save the result of subtractingdropoff_datetime
andpickup_datetime
columns. - Sort the entire dataframe by newly created column in descending order. Save it in
df_sort
. - Print the top-5 longest and shortest trips.
Thanks for your feedback!
Challenge: Extreme Trips Durations
Now we have the respective columns converted into the correct type. It means now we can manipulate them using the learned methods.
We already have column trip_duration
in our dataset, so why do we need to work with datetime
objects? Yes, we have, but this number is in seconds, which is not readable at all (since there are 60 seconds in one minute, not 100). Let's see if there are outliers in our dataset.
Task
- Create new column
duration
indf
dataframe and save the result of subtractingdropoff_datetime
andpickup_datetime
columns. - Sort the entire dataframe by newly created column in descending order. Save it in
df_sort
. - Print the top-5 longest and shortest trips.
Thanks for your feedback!
Now we have the respective columns converted into the correct type. It means now we can manipulate them using the learned methods.
We already have column trip_duration
in our dataset, so why do we need to work with datetime
objects? Yes, we have, but this number is in seconds, which is not readable at all (since there are 60 seconds in one minute, not 100). Let's see if there are outliers in our dataset.
Task
- Create new column
duration
indf
dataframe and save the result of subtractingdropoff_datetime
andpickup_datetime
columns. - Sort the entire dataframe by newly created column in descending order. Save it in
df_sort
. - Print the top-5 longest and shortest trips.