October 2019
Beginner to intermediate
674 pages
16h 43m
English
A timestamp object is made of several components, namely, year, month, day, hour, minute, and second. For many time series analyses, it is important to segregate these components and keep them as new columns for later usage.
Since we have made the date column our index, it becomes a lot easier. A separate column for each component can be created as follows:
ts['Year']=ts.index.yearts['Month']=ts.index.monthts['Day']=ts.index.dayts['Hour']=ts.index.hourts['Minute']=ts.index.minutets['Second']=ts.index.second
The following is the output:

Read now
Unlock full access