Convert various string dates to a Year and Month column
I've got a table in which there is a column known as Period. It describes the year and month as, for example, 1998MM02. In addition, it also has the row 1998JJ00, which in this case is the overall year accumulation. A brief example below:
What I want is two separate columns, one that contains the Year and another containing the Month. So far, I managed to remove the characters from the Period column, and managed to separate it into two additional columns Year and Month. However, the year accumulation (i.e. 1998JJ00) is in both columns NaN ( - ).
What is a simple solution to get the output given below ?