I was working with a dataset that had a 'period of stay' feature and had a value like Mar-May I want to convert it to numerical form

I was working with a dataset that had a 'period of stay' feature and had a value like Mar-May
I want to convert it to numerical form .One obvious way is to take the difference between the 2 months.But How can I do it, can someone help
You already invited:

peter

Upvotes from:

you can probably convert it to a date format and then do a difference between the two dates. You would, of course, need to convert the string "Mar-May" split by the dash into "Mar" "May" and then conver the data.

I'm not sure what programming language you're using, but I'm pretty sure the one you're using would have some date data type that you can use that understands time arithmetic to solve your problem.

Hope that helps. Good luck!

If you wanna answer this question please Login or Register