time-based features each temporal value also has time component that can be used to extract useful information and features pertaining to the time these include attributes like hourminutesecondmicrosecondutc offsetand more the following code snippet extracts some of the previously mentioned time-based features from our temporal data in [ ]df['hour'df['ts_obj'apply(lambda dd hourdf['minute'df['ts_obj'apply(lambda dd minutedf['second'df['ts_obj'apply(lambda dd seconddf['musecond'df['ts_obj'apply(lambda dd microseconddf['utc_offset'df['ts_obj'apply(lambda dd utcoffset()df[['time''hour''minute''second''musecond''utc_offset']figure - time based features in temporal data the features depicted in figure - show some of the attributes we talked about earlier which have been derived purely from the time segment of each temporal value we can further engineer these features based on categorical feature engineering techniques and even derive other features like extracting time zones let' try to use binning to bin each temporal value into specific time of the day by leveraging the hour feature we just obtained in [ ]hour_bins [- bin_names ['late night''morning''afternoon''evening''night'df['timeofdaybin'pd cut(df['hour']bins=hour_binslabels=bin_namesdf[['time''hour''timeofdaybin']out[ ]time hour timeofdaybin : : + : morning : :: afternoon : : + : night : : + : late night thus you can see from the preceding output that based on hour ranges ( - - - - - we have assigned specific time of the day bin for each temporal value the utc offset component of the temporal data is very useful in knowing how far ahead or behind is that time value from the utc (coordinated universal time)which is the primary time standard that clocks and time are regulated from this information can also be used to engineer new features like potential time zones from which each temporal value might have been obtained the following code helps us achieve the same