The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Nominal to Date for quarterly data
I have an attribute includes following nominal data:
2011-Q1
2011-Q2
2011-Q3
...
I hope to change them to Date, however the date format shows only Year, Month and Day but no Quarter. Is there anyway I can solve this? Thanks for the help!
2011-Q1
2011-Q2
2011-Q3
...
I hope to change them to Date, however the date format shows only Year, Month and Day but no Quarter. Is there anyway I can solve this? Thanks for the help!
Tagged:
0
Best Answer
-
BalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 UnicornHi,
these are not full dates. You need to define yourself which date you want to refer to. The first day of the quarter? The middle one? The end?
If the first day is OK, here's a formula you can use in Generate Attributes to create an exact nominal date from the quarter:prefix(date, 5) + str(1 + (parse(suffix(date, 1)) - 1) * 3) + "-01"
You can then convert this to an actual date attribute with Nominal to Date and the date format "yyyy-M-dd".
Regards,
Balázs
1
Answers
@hmhsing , unfortunately, I do not come with an answer but with a question ....
I tried to convert your attribute to a date attribute using the following Python script but without success...
But for an unknown reason, the line :
re-initialize the date to 1970 and does not apply the required format. In deed I obtain as final result :
Is it the normal behavior ?
Regards,
Lionel
PS : in attached file, my (unsucessful) process.