out[ ] in [ ]dt minute out[ ] given datetime instanceyou can extract the equivalent date and time objects by calling methods on the datetime of the same namein [ ]dt date(out[ ]datetime date( in [ ]dt time(out[ ]datetime time( the strftime method formats datetime as stringin [ ]dt strftime('% /% /% % :% 'out[ ] : strings can be converted (parsedinto datetime objects using the strptime functionin [ ]datetime strptime(' ''% % % 'out[ ]datetime datetime( see table - for full list of format specifications when aggregating of otherwise grouping time series datait will occasionally be useful to replace fields of series of datetimesfor example replacing the minute and second fields with zeroproducing new objectin [ ]dt replace(minute= second= out[ ]datetime datetime( the difference of two datetime objects produces datetime timedelta typein [ ]dt datetime( in [ ]delta dt dt in [ ]delta out[ ]datetime timedelta( in [ ]type(deltaout[ ]datetime timedelta adding timedelta to datetime produces new shifted datetimein [ ]dt out[ ]datetime datetime( in [ ]dt delta out[ ]datetime datetime( control flow ifelifand else the if statement is one of the most well-known control flow statement types it checks condition whichif trueevaluates the code in the block that followsif print 'it' negative appendixpython language essentials www it-ebooks info