December 2018
Beginner
720 pages
15h 32m
English
As in the majority of scientific disciplines, dates and times play an important role in finance. This appendix introduces different aspects of this topic when it comes to Python programming. It cannot, of course, be exhaustive. However, it provides an introduction to the main areas of the Python ecosystem that support the modeling of date and time information.
The datetime module from the Python standard library allows for the implementation of the most important date and time–related tasks:
In[1]:frompylabimportmpl,pltplt.style.use('seaborn')mpl.rcParams['font.family']='serif'%matplotlibinlineIn[2]:importdatetimeasdtIn[3]:dt.datetime.now()Out[3]:datetime.datetime(2018,10,19,15,17,32,164295)In[4]:to=dt.datetime.today()toOut[4]:datetime.datetime(2018,10,19,15,17,32,177092)In[5]:type(to)Out[5]:datetime.datetimeIn[6]:dt.datetime.today().weekday()Out[6]:4
Of course, datetime objects can be ...
Read now
Unlock full access