I'm trying to loop through a data frame created by pandas, looking for each value that only occurs once in the frame. My code so far is the following:
import pandas as pd
df = pd.read_csv('xyz.csv')
saved_column = df['S07'][df['Class'].isin(['GTD'])].round(decimals=1).value_counts()
How can I loop through this data frame, detecting all values that occur only once and ultimately delete them from the csv-file?
Thank you very much in advance for your help!
An example would be: (Input data in csv-file)
In [2]: df
Out[2]: Class S07
GTD 2.23
GTD 2.21
GTD 1.82
GTD 2.26
I want the code to delete the line with GTD - 1.82, since its rounded value (1.8) only occurs once within the dataset.
Sample dataset: https://1drv.ms/u/s!AvuwPSn7axNcePUsJD8kMB1FnlE