i have an dataframe like this:
quantity price
202 1 3.99
287 1 3.99
309 1 3.99
1345 3 11.97
1681 1 14.36
... ... ...
275754 1 3.59
275922 1 3.99
275927 1 3.99
276012 1 3.99
276065 1 3.59
And i need unique itemprices:
df['item_price'] = (df['price'] / df['quantity'])
but
df.item_price.unique()
gives this: (note the 3.99)
[ 3.99, 0. , 3.99, 3.59, 14.36]
i have tried many solutions (strip()
,str.replace(' ', '')
, return_index=False
, return_inverse=False
, return_counts=False
... and so on),
But without luck.
3.99 is always doubled.
Whats wrong with that?