-3

I have an Excel file with 3 seperate columns:

- CaseID_A
- CaseID_B
- Grouping_ID

The first two columns contain cases which are connected to each other, e.g:

 A|B, B|A, A|C, C|D, Z|B

How can I get a grouped family, where all possible connections are considered? The group should get a groupID in the respective column.

zafiros
  • 3
  • 3
  • 2
    You may get more help if you attempt some code yourself and post it with your question. – benvc Sep 06 '19 at 18:01
  • What have you tried and what exactly do you need help with? Stack Overflow is not a code-writing service. – wjandrea Sep 06 '19 at 22:29

1 Answers1

1

You might try using pandas DataFrames for your data, then select only rows that already satisfy one criteria, for example select all columns that satisfy B, then look in A. In a similar fashion as done for conditional probabilities here [How to calculate conditional probability of values in dataframe pandas-python?

Then from there you could build a matrix/list/array combining all possible combination in a manner to your preference.

Hope this helps you on your way.

Emily
  • 354
  • 3
  • 10