I have a csv with 3 columns:
Unique ID, Phone Number, 1 or 0,
Some phone numbers are duplicated but the 1 or 0 column does not always match for all the duplicated instances.
I need to get to a CSV that lists the duplicate phone numbers where 1 or 0 do not match.
For example:
Unique ID | Phone | 1 or 0 |
---|---|---|
YYHA | 555-5555 | 1 |
UUDS | 555-5555 | 1 |
UUFA | 123-4567 | 0 |
UUCD | 123-4567 | 1 |
I need a CSV of:
Unique ID | Phone | 1 or 0 |
---|---|---|
UUFA | 123-4567 | 0 |
UUCD | 123-4567 | 1 |
So far, I have found a way to get the phone numbers to group using:
df = pd.read_csv(‘Example’)
duplicates = df[df.duplicated(subset [‘Phone Number’], keep = False] but I am struggling to go from there to get the list I need.
submitted by /u/bcpeagle
[link] [comments]
r/learnpython I have a csv with 3 columns: Unique ID, Phone Number, 1 or 0, Some phone numbers are duplicated but the 1 or 0 column does not always match for all the duplicated instances. I need to get to a CSV that lists the duplicate phone numbers where 1 or 0 do not match. For example: Unique ID Phone 1 or 0 YYHA 555-5555 1 UUDS 555-5555 1 UUFA 123-4567 0 UUCD 123-4567 1 I need a CSV of: Unique ID Phone 1 or 0 UUFA 123-4567 0 UUCD 123-4567 1 So far, I have found a way to get the phone numbers to group using: df = pd.read_csv(‘Example’) duplicates = df[df.duplicated(subset [‘Phone Number’], keep = False] but I am struggling to go from there to get the list I need. submitted by /u/bcpeagle [link] [comments]
I have a csv with 3 columns:
Unique ID, Phone Number, 1 or 0,
Some phone numbers are duplicated but the 1 or 0 column does not always match for all the duplicated instances.
I need to get to a CSV that lists the duplicate phone numbers where 1 or 0 do not match.
For example:
Unique ID | Phone | 1 or 0 |
---|---|---|
YYHA | 555-5555 | 1 |
UUDS | 555-5555 | 1 |
UUFA | 123-4567 | 0 |
UUCD | 123-4567 | 1 |
I need a CSV of:
Unique ID | Phone | 1 or 0 |
---|---|---|
UUFA | 123-4567 | 0 |
UUCD | 123-4567 | 1 |
So far, I have found a way to get the phone numbers to group using:
df = pd.read_csv(‘Example’)
duplicates = df[df.duplicated(subset [‘Phone Number’], keep = False] but I am struggling to go from there to get the list I need.
submitted by /u/bcpeagle
[link] [comments]