Having finished all the most urgent tasks at work and having started the year end vacation I decided to pick up my python learning on Datacamp again. I followed the course on working with dates and types in python which is part of their python programmer track. It was a nice introduction to the datetime library and how to use datetime objects in pandas. The nice thing about python is that for almost every task you can think of there is probably a library out there to do the heavy lifting for you. This is also the case for dates and times and if you need to calculate durations between 2 dates then the datetime library makes this easy. It can handle timezones and daylight saving time as well. There is even an database with all the different timezones that you can refer to and if anything changes for a certain timezone then this database will be updated with that new information without any effort required from your side. If you used datetimes in a pandas dataframe you can even change timezones or calculate time deltas between entire column in one go, super easy. In the course they warned not to go back too far in time when calculating differences between datetimes. I wondered just how you can go back and as it happens I started re reading The Discoverers from Daniel Boorstin. The first chapters are about time and the evolution of the calendar. Our current calendar goes back to 1582 when the Pope decided to put it back in order and synchronise it again with Easter. As a result in that year October 4th was followed by October 15th. Going back further will cause problems for datetime based time deltas obviously. To complicate matters the UK and the American colonies only adapted this calendar in 1752 so depending on your location, aka timezone you might in theory be able to go back to either 1582 or 1752. And then there were a couple of revolutions left and right like in France or Russia where revolutionary calendars were introduced for a short period of time. I now wonder if all the historical dates I had to learn by heart as a kid about events before 1582 were according to our current calendar or according the calendar in vogue at the time of the historical event. Maybe that is why I had such a hard time remembering them all …
Leave a comment