Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

python - How to extract only the first occurrences of rows corresponding to a specific column in pandas

I have a pandas dataframe of over 100,000 which is already sorted accordingly, however given this sorted dataframe I'm trying to only extract the rows associated with the first occurrence of a specific column. I give an example below where the dataframe df can be considered the sorted dataframe I already have

d = {'id': [10,32,4,10,11,5,32,10], 'A': ['S', 'F', 'R', 'Z','X','T','S','B]}
df = pd.DataFrame(data=d)

print(df)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...