Puzzle 3: Month by Month
Let's exercise our minds by solving a pandas DataFrame puzzle.
We'll cover the following
Guess the output
Try to guess the output of the code below:
from io import StringIOimport pandas as pdcsv_data = '''\day,hits2020-01-01,4002020-02-02,8002020-02-03,600'''df = pd.read_csv(StringIO(csv_data))print(df['day'].dt.month.unique())
Quiz
Q
What is the output of the code above?
A)
AttributeError
B)
[1 2]
C)
[1]
D)
SyntaxError
Get hands-on with 1300+ tech skills courses.