Dates and Times

HW
Week11
Week12
Author

Homework

Published

Due: April 17, 2023

Note: This assignment must be submitted in github classroom.

import pandas as pd
import datetime

Note: This assignment is modified from the decodeR exercises by Kelly Bodwin.

1 Warm-up exercises

(Do this in R AND python)

Answer the following using code (even if you know the answer already).

  1. Save your birthday as a Datetime object.
  2. What day of the week does/did your birthday fall on in 2019?
  3. On what day of the week should you plan your 100th birthday party?
  4. Find the date that is exactly 9 months before your birthday. If it falls on a holiday, think about the implications.
  5. The following code loads a dataset giving the date ranges for the 12 Zodiac signs. By making appropriate adjustments and calculations, find your Zodiac sign.
zodiac <- read.csv("https://raw.githubusercontent.com/unl-stat251/09-datetime/main/zodiac.csv")

# Birthday saved as a datetime object

# Day of the week your birthday fell on in 2019

# Day of the week of your 100th birthday party

# Date that is 9 months before your birthday

# Zodiac sign
zodiac = pd.read_csv("https://raw.githubusercontent.com/unl-stat251/09-datetime/main/zodiac.csv")

# Birthday saved as a datetime object

# Day of the week your birthday fell on in 2019

# Day of the week of your 100th birthday party

# Date that is 9 months before your birthday

# Zodiac sign

2 Solve the mystery

(Do this in R or Python, but you don’t have to do it in both)

Speaking of the Zodiac, one of the most famous mysteries in California history is the identity of the so-called “Zodiac Killer”, who murdered 7 people in Northern California between 1968 and 1969.

A new murder was committed last year in California, suspected to be the work of a new Zodiac Killer on the loose. Fortunately, a camera was planted at the location where the body was found. The FBI has provided you with a list of people who entered the building last year, and what date and time they entered, in Pacific Standard Time (PST).

suspects <- read.csv("https://raw.githubusercontent.com/unl-stat251/09-datetime/main/suspects.csv")

Unfortunately, the date and time of the murder is not known. You have been hired to crack the case. Use the clues below to discover the murderer’s identity.

  1. Based on the sunburn patterns on the body, the murder was not committed in the morning.

  2. The room where the murder was committed is closed Tuesdays and Thursdays, so the murder did not happen on those days.

  3. It is believed that the murder was committed within 5 weeks (35 days) of Thanksgiving, 2018.

  4. It was discovered that just before being murdered, the victim tried to send a text to her sister in Iceland, saying “Goodnight over there!”

  5. The Killer left behind a birthday card at the scene of the crime. The date is smudged, but the number of the day is shown to be 22. It is thought that perhaps this murder took place less than two days after the Killer’s birthday.

  6. The Killer him/herself is amused by our efforts, and he has sent us a cryptic clue: “The number of minutes between Jan 1, 1970 at midnight and the time I arrived on the scene is divisible by 10.”

Who is the killer?