Puzzle 16 Y3K
Pandas Brain Teasers — by Miki Tebeka (24 / 34)
👈 Free-Range | TOC | Not My Type 👉
import pandas as pd
y3k = pd.Timestamp(3000, 1, 1)
print(f'They arrived to Earth on {y3k:%B %d}.')
Guess the Output
IMPORTANT
Try to guess what the output is before moving to the next page.
This code will raise an OutOfBoundsDatetime exception.
Computers and time have a complicated relationship. There are daylight saving time, leap years, time zones, and more details to work out.
Computers store time as the number of seconds since January 1, 1970, GMT.
2038
WARNING
This means that in 2038, time will overflow on 32-bit machines. Ouch!
Python’s datetime and pandas.Timestamp, which is based on it, are written mostly in C and have a fixed amount of space for storing time information. This means there’s a maximal and minimal value to datetime.