Legacy – Predicting Future Day Workout
- 01:38
Workout demonstrating how to predict future day based on a specific date provided.
Transcript
We should now have a look at importing the data module and using all the gained knowledge in predicting something. So in case we know the filing date of s&p 500 company in the future, but we don't know what day it is, we are not just going to go next, next next on a calendar until we get the date, we can do it a lot more easier. To do that. Firstly, we need to import the data module. And then from date time, import, date, and then import calendar. So now let's assume you know the date. So let's assume my date equal to so we know that the filing date in the future is in 2022. It is on the ninth which is September 14th 2022. And how do we predict it so we want to print the calendar using the calendar because the date will be going back to a calendar referencing the actual date, and then you want the day name from the calendar of the my date. And in terms of the week. If you remember in the previous chapters, we looked at reference getting the day using the weekday that number, the indexing number, so we are converting our date into the index number and going back to the calendar to refer the date to get the day name. So let's run this. Perfect. It's a Wednesday just for checking let's look at the 15th which is a Thursday so it's working perfect.