You'll probably never have a time machine, but how about a machine for analyzing time? As soon as time enters any analysis, things can get weird. It's easy to get tripped up on day and month boundaries, time zones, daylight saving time, and all sorts of other things that can confuse the unprepared. If you're going to do any kind of analysis involving time, you’ll want to use Python to sort it out. Working with data sets on hurricanes and bike trips, we’ll cover counting events, figuring out how much time has elapsed between events and plotting data over time. You'll work in both standard Python and in Pandas, and we'll touch on the dateutil library, the only timezone library endorsed by the official Python documentation. After this course, you'll confidently handle date and time data in any format like a champion.
Dates and CalendarsFree
Hurricanes (also known as cyclones or typhoons) hit the U.S. state of Florida several times per year. To start off this course, you'll learn how to work with date objects in Python, starting with the dates of every hurricane to hit Florida since 1950. You'll learn how Python handles dates, common date operations, and the right way to format dates to avoid confusion.Dates in Python50 xpWhich day of the week?100 xpHow many hurricanes come early?100 xpMath with dates50 xpSubtracting dates100 xpCounting events per calendar month100 xpPutting a list of dates in order100 xpTurning dates into strings50 xpPrinting dates in a friendly format100 xpRepresenting dates in different ways100 xp
Combining Dates and Times
Bike sharing programs have swept through cities around the world -- and luckily for us, every trip gets recorded! Working with all of the comings and goings of one bike in Washington, D.C., you'll practice working with dates and times together. You'll parse dates and times from text, analyze peak trip times, calculate ride durations, and more.Dates and times50 xpCreating datetimes by hand100 xpCounting events before and after noon100 xpPrinting and parsing datetimes50 xpTurning strings into datetimes100 xpParsing pairs of strings as datetimes100 xpRecreating ISO format with strftime()100 xpUnix timestamps100 xpWorking with durations50 xpTurning pairs of datetimes into durations100 xpAverage trip time100 xpThe long and the short of why time is hard100 xp
Time Zones and Daylight Saving
In this chapter, you'll learn to confidently tackle the time-related topic that causes people the most trouble: time zones and daylight saving. Continuing with our bike data, you'll learn how to compare clocks around the world, how to gracefully handle "spring forward" and "fall back," and how to get up-to-date timezone data from the dateutil library.UTC offsets50 xpCreating timezone aware datetimes100 xpSetting timezones100 xpWhat time did the bike leave in UTC?100 xpTime zone database50 xpPutting the bike trips into the right time zone100 xpWhat time did the bike leave? (Global edition)100 xpStarting daylight saving time50 xpHow many hours elapsed around daylight saving?100 xpMarch 29, throughout a decade100 xpEnding daylight saving time50 xpFinding ambiguous datetimes100 xpCleaning daylight saving data with fold100 xp
Easy and Powerful: Dates and Times in Pandas
To conclude this course, you'll apply everything you've learned about working with dates and times in standard Python to working with dates and times in Pandas. With additional information about each bike ride, such as what station it started and stopped at and whether or not the rider had a yearly membership, you'll be able to dig much more deeply into the bike trip data. In this chapter, you'll cover powerful Pandas operations, such as grouping and plotting results by time.Reading date and time data in Pandas50 xpLoading a csv file in Pandas100 xpMaking timedelta columns100 xpSummarizing datetime data in Pandas50 xpHow many joyrides?100 xpIt's getting cold outside, W20529100 xpMembers vs casual riders over time100 xpCombining groupby() and resample()100 xpAdditional datetime methods in Pandas50 xpTimezones in Pandas100 xpHow long per weekday?100 xpHow long between rides?100 xpWrap-up50 xp
In the following tracksData Scientist with PythonData Scientist Professional with PythonPython DeveloperPython Toolbox
PrerequisitesData Manipulation with pandas
DataCamp Content CreatorSee More
DataCamp offers interactive R, Python, Spreadsheets, SQL and shell courses. All on topics in data science, statistics, and machine learning. Learn from a team of expert teachers in the comfort of your browser with video lessons and fun coding challenges and projects.