Reading an imported dataset, I am trying to divide two string columns in the dataset:
df['Cost'] = (df['Paid']/df['Items'])
I also tried:
df['Cost'] = df['Paid']/df['Items']
and
df['Cost'] = df['Paid'].div(df['Items'])
The paid column has decimal points and some values are 00.00
. Can you get a mean value on a sting column? Will I have issues using this column as string?
I get the following error
error: Unsupported operand type(s) for /: 'str' and 'str'
when trying to change type to float, so trying to work with string. This is the error when trying to change to float:
ValueError: could not convert string to float: '(94.00)')