Given graphlab SFrame where there is a column with dates, for example:
+-------+------------+---------+-----------+ | Store | Date | Sales | Customers | +-------+------------+---------+-----------+ | 1 | 2015-07-31 | 5263.0 | 555.0 | | 2 | 2015-07-31 | 6064.0 | 625.0 | | 3 | 2015-07-31 | 8314.0 | 821.0 | | 4 | 2015-07-31 | 13995.0 | 1498.0 | | 3 | 2015-07-20 | 4822.0 | 559.0 | | 2 | 2015-07-10 | 5651.0 | 589.0 | | 4 | 2015-07-11 | 15344.0 | 1414.0 | | 5 | 2015-07-23 | 8492.0 | 833.0 | | 2 | 2015-07-19 | 8565.0 | 687.0 | | 10 | 2015-07-09 | 7185.0 | 681.0 | +-------+------------+---------+-----------+ [986159 rows x 4 columns]
Is there an easy way in the graphlab / other python function to convert a Date column to Year | Month | Day?
+-------+------+----+----+---------+-----------+ | Store | YYYY | MM | DD | Sales | Customers | +-------+------+----+----+---------+-----------+ | 1 | 2015 | 07 | 31 | 5263.0 | 555.0 | | 2 | 2015 | 07 | 31 | 6064.0 | 625.0 | | 3 | 2015 | 07 | 31 | 8314.0 | 821.0 | +-------+------------+---------+-----------+ [986159 rows x 4 columns]
In pandas I can do this: What is the fastest way to retrieve a day, month and year from a specific date?
But converting SFrame to Panda to split the date and converting back to SFrame is quite difficult.
alvas source share