How can I fetch number string from prod column, like in the below example.
df:
Id Prod
xisos clor 12Oz pack of 12
kasos zemd 13 Oz pack of 1
oaldd lb24 pk 12
odldf 12-ct kalsj 19992
jsdkl OZ 32 ksldj 45 x 76
I need to fetch the sizes from prod with the logic, where ever I see the listed pattern [Oz, oz,...lb] I will fetch the numbers which appears before or after the listed units.
unit_list = [oZ,OZ,lb,ct]
Suppose i have a list called unit_list, i need to check the numbers which comes before one of unit_list if it there else we need to check after one of unit_list values.
df_Output:
Id Prod Size
xisos clor 12oz pack of 12 12
kasos zemd 13 Oz pack of 1 13
oaldd lb24 pk 12 24
odldf 12-ct kalsj 19992 12
jsdkl OZ 32 ksldj 45 x 76 32