Your requirement is not quite clear. I'd suggest to use
pandas.DataFrame[
^] with methods:
-
read_csv[
^]
-
drop_duplicates[
^].
For example:
df = pd.DataFrame({
'brand': ['Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
'style': ['cup', 'cup', 'cup', 'pack', 'pack'],
'rating': [4, 4, 3.5, 15, 5]
})
df.drop_duplicates(subset=['brand'])
#before:
brand style rating
0 Yum Yum cup 4.0
1 Yum Yum cup 4.0
2 Indomie cup 3.5
3 Indomie pack 15.0
4 Indomie pack 5.0
#after:
brand style rating
0 Yum Yum cup 4.0
2 Indomie cup 3.5