Created
August 8, 2018 08:21
-
-
Save FelixChop/e8decd1c6d61893b628f68db12be15c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| column_edge = 'Phone number' | |
| column_ID = 'ID' | |
| data_to_merge = df[[column_ID, column_edge]].dropna(subset=[column_edge]).drop_duplicates() # select columns, remove NaN | |
| # To create connections between people who have the same number, | |
| # join data with itself on the 'ID' column. | |
| data_to_merge = data_to_merge.merge( | |
| data_to_merge[[column_ID, column_edge]].rename(columns={column_ID:column_ID+"_2"}), | |
| on=column_edge | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment