Path: blob/master/lessons/lesson_16/solution-code/01_time_series_solutions.ipynb
1904 views
Kernel: Python 2
Working With Time Series Data
Independent Practice
Instructor Note: These are optional and can be assigned as student practice questions outside of class.
1) Create a datetime
object representing today's date.
In [19]:
In [20]:
Out[20]:
2018-02-25 23:31:01.844089
2) Load the UFO data set from the internet.
In [21]:
In [22]:
Out[22]:
In [23]:
Out[23]:
City object
Colors Reported object
Shape Reported object
State object
Time object
dtype: object
3) Convert the Time
column to a datetime
object.
In [24]:
In [25]:
Out[25]:
In [26]:
Out[26]:
City object
Colors Reported object
Shape Reported object
State object
Time datetime64[ns]
dtype: object
4) Set the Time
column to the index of the DataFrame.
In [27]:
In [28]:
Out[28]:
5) Create a timestamp
object for the date January 1, 1999.
In [29]:
6) Use the timestamp
object to perform logical filtering on the DataFrame and create a subset of entries with a date above or equal to January 1, 1999.
In [30]:
In [31]:
Out[31]: