Python Duplicate Value Comparison

Asked 1 years ago, Updated 1 years ago, 390 views

Suppose the data is as follows:

id, d1

A, 1

B, 2

A, 3

C, 4

D, 5

E, 6

If A is duplicated in id because A is duplicated in id as follows, I would like to compare the value of d1 column and delete it, leaving only A with a larger value.

id, d1

A, 3

B, 2

C, 4

D, 5

E, 6

python

2022-10-28 00:00

1 Answers

I think it would be good to use dictionary.
https://wikidocs.net/16

Anyone can be distinguished by "name" = "Hong Gil-dong", "birthday" = "month and date". Python cleverly has a data type that can represent this correspondence. Most languages used these days also have a data type that represents this correspondence, which is called an Associative array or Hash.


2022-10-28 00:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.