sortit

numpy学习(三)

拥有回忆 提交于 2020-12-14 04:51:55
练习篇(Part 3) 31. 略 32. Is the following expressions true? (★☆☆) 1 np.sqrt(-1) == np.emath.sqrt(-1) 1 print (np.sqrt(-1) == np.emath.sqrt(-1)) 运行结果:False 33. How to get the dates of yesterday, today and tomorrow? (★☆☆) 1 yesterday = np.datetime64( ' today ' , ' D ' ) - np.timedelta64(1, ' D ' ) 2 today = np.datetime64( ' today ' , ' D ' ) 3 tomorrow = np.datetime64( ' today ' , ' D ' ) + np.timedelta64(1, ' D ' ) 4 print ( " yesterday: " + str(yesterday)) 5 print ( " today: " + str(today)) 6 print ( " tomorrow: " +str(tomorrow)) 运行结果: yesterday:2019-09-24 today:2019-09-25 tomorrow:2019-09-26 34.