Dealing with dates/times in Python and R script steps
The handling of date, date/time, and time fields is native in Power BI. If you want to add a Python or R script step from a dataset containing a date/time field, you would expect to find that field in the default dataset
dataframe with the corresponding data type depending on whether it is a Python or R script. Unfortunately, it is not so straightforward. But with a little forethought, it is possible to handle these data types in the right way.
The code used in both Python and R makes use of date-specific functions with which you may not be too familiar. It is not important to completely know them for the purposes of understanding the section; you can delve into them later when you need to.
In the folder pertaining to Chapter 4 in the GitHub repository associated with the book, you will find the date-time-fields.xlsx
Excel file containing the dates
sheet with only date, date/time, and time fields:
Figure 4.49:...