Date-time data types and tools
from Import = datetime.now ()print(now.year,now.month,now.day)# stores time in milliseconds Delta = now-datetime (1992,2,2)print(delta)print(delta.days) # You can subtraction from import timedeltaprinton the timestamp ( Delta+timedelta (12))
String and DateTime conversions
#Time Turn strTime_str = Now.strftime ('%y-%m-%d')Print(TIME_STR)#Str Turn TimeTIME_STR2 = Datetime.strptime (Time_str,'%y-%m-%d')Print(TIME_STR2)#working with group datesData_set = ['2017-1-1','2018-1-1']pd.to_datetime (Data_set)
Time Series Basics
Time_set = [DateTime (2017,1,1), DateTime (2017,2,1), DateTime (2017,3,1), DateTime (2017,4,1), datetime (2017,5,1 = PD. DataFrame (Np.arange (5), index== PD. DataFrame (NP.RANDOM.RANDN (+), Index=pd.date_range ('1992-2-2', periods=1000)) # can also do slices data['1992-3-2':]
Python Data Analysis-date processing