Skip to content
Working with Dates and Times in Python
Working with Dates and Times in Python
👋 Welcome to your workspace! Here, you can write and run Python code and add text in Markdown. Below, we've imported the datasets from the course Working with Dates and Times in Python and the packages used in the course. This is your sandbox environment: analyze the course datasets further, take notes, or experiment with code!
# Importing course packages; you can add more too!
import pandas as pd
import matplotlib.pyplot as plt
from datetime import date, datetime, timezone, timedelta
from dateutil import tz
import pickle
# Importing course datasets
rides = pd.read_csv('datasets/capital-onebike.csv')
with open('datasets/florida_hurricane_dates.pkl', 'rb') as f:
florida_hurricane_dates = pickle.load(f)
florida_hurricane_dates = sorted(florida_hurricane_dates)
rides.head() # Display the first five rows# Begin writing your own code here!Don't know where to start?
Try completing these tasks:
- Count how many hurricanes made landfall each year in Florida using
florida_hurricane_dates. - Reload the dataset
datasets/capital-onebike.csvso that it correctly parses date and time columns. - Calculate the average trip duration of bike rentals on weekends in
rides. Compare it with the average trip duration of bike rentals on weekdays.