0

I have a csv with one column but I am trying to look within that column and drop all duplicate values

Column A
10
10
11
15
15
2

I want the end result to be:

Column A
10
11
15
2

See below for my code...I realize that the drop_duplicates code is looking for duplicates in a row so it wouldn't catch the duplicates in my column. Is there another way to look for duplicates within a column instead?

portfolio_file = file.csv

df = pd.read_csv(portfolio_file)
df.drop_duplicates.(inplace=True)
df.to_csv(file.csv, index=False)
mozway
  • 194,879
  • 13
  • 39
  • 75
bananas
  • 133
  • 8

0 Answers0