The isWeek function checks whether the data type of the attribute specified in the string parameter is week.
The nominal attribute to be tested. The string parameter is mandatory.
If the optional binary parameter is True, or not specified, results will be provided as Booleans (True/False), while if it is False, results will be provided in binary form (1/0).
The following example uses the Turkish Calendar dataset.
In this example, we want to check if the WEEK_OF_YEAR attribute is a Week attribute.
Change the WEEK_OF_YEAR attribute type to nominal, as the string parameter needs to be nominal.
We add a new attribute, that we will call isweek, and write the following formula to fill it:
We wrote False as we want our results to be displayed in binary form.
As the values of the WEEK_OF_YEAR attribute are not in the formats listed above, the function has returned only 0, which means false, setting the isweek attribute type as integer.