I have a pandas DataFrame with string-columns and float columns I would like to use drop_duplicates to remove duplicates. Some of the duplicates are not exactly the same, because there are some slight differences in low decimal places. How can I remove duplicates with less precision?
Example:
import pandas as pd
df = pd.DataFrame.from_dict({'text': ['aaa','aaa','aaa','bb'], 'result': [1.000001,1.000000,2,2]})
df
     result text
0  1.000001  aaa
1  1.000000  aaa
2  2.000000  aaa
3  2.000000   bb
I would like to get
df_out = pd.DataFrame.from_dict({'text': ['aaa','aaa','bb'], 'result': [1.000001,2,2]})
df_out
     result text
0  1.000001  aaa
1  2.000000  aaa
2  2.000000   bb