Convert years and months to months. Pls help me fast

Convert the “Credit_History_Age” to the count of months and store it in the integer format. For
example, if the original value from a tuple is “22 Years and 1 Months”, the value will be 265 after
the conversion (22 * 12 + 1 = 265). Store the converted result in a new attribute called
“Total_CHA.” List the node(s) (in sequence) and the corresponding command(s) used in this
process.

Hi
Depending how “messy” your data is I would probably try sth like splitt cell by " Year" first convert string to number and use math formula to multiply times 12. If there is only month in the second split i would use regex to extract the digits “\d+” and convert the remaining number stored as string into a number datatype afterwards
Finally add the two columns together (e.g. using math formula or column aggregator)
br

3 Likes

Hello @drip

You can use the Column Expressions node and Math Formula node for your reference, as shown in the attached images and workflow.

Convert years and months to months. Pls help me fast.knwf (74.6 KB)

Output:

2 Likes