Puzzle 20: It's a Date!

Let's solve a Timestamp and date_range puzzle.

We'll cover the following

Guess the output

Try to guess the output of the code below:

Press + to interact
import pandas as pd
start = pd.Timestamp.fromtimestamp(0).strftime('%Y-%m-%d')
times = pd.date_range(start=start, freq='M', periods=2)
print(times)

Quiz

Q

What is the output of the code above?

A)
DatetimeIndex(['31-01-1970', '28-02-1970'], dtype='datetime64[ns]', freq='M')
B)
DatetimeIndex(['01-31-1970', '02-28-1970'], dtype='datetime64[ns]', freq='M')
C)
DatetimeIndex(['1970-01-31', '1970-02-28'], dtype='datetime64[ns]', freq='M')
D)
DatetimeIndex(['1970-01-31', '1970-02-28'], dtype='datetime64[ns]', freq='M', periods=2)

Get hands-on with 1300+ tech skills courses.