I have a df that I'm trying populate a new column based on a calculation. Here is an example below.
import pandas as pd
import numpy as np
df = pd.DataFrame(
{"Quantity" :[4721,1647],
"Total" : [236.05,82.35]},
index = [1,2])
df["CPS Gross"]= (df["Total"]/df["Quantity"])
conditions = [df["CPS Gross"] == 0.05]
values = [0.03]
df["CPS Calc"] = np.select(conditions,values)
print(df)
Can someone explain to me why the second row does not meet the condition test but the first row does even though they both meet the criteria of 0.05?
Any help would be much appreciated