Skip to main content

How to substract numeric and alphanumeric value in python [closed]

I have 2 columns with numeric and alphanumeric values. I want to apply subtraction on numeric value in the third column and keep alphanumeric value as "Canadian". Please help

I tried this

data['difference'] = df.apply(
    lambda x: diff(x['col1'], x['col2']), axis=1)

I was expecting to get the output of substraction but getting error on alphanumeric value



source https://stackoverflow.com/questions/75756024/how-to-substract-numeric-and-alphanumeric-value-in-python

Comments