I am trying to create a code for the following data:
I have imported the data using the code:
import csv
import itertools
import pandas as pd
input_file="computation.csv"
cmd=pd.read_csv(input_file)
subset = cmd[['Carbon A', 'Carbon B']]
carbon_pairs = [tuple(y) for y in subset.values]
c_pairs = carbon_pairs
I want to create a code that has the output:
1 is connected to
2
4
6
7
8
2 is connected to
1
4
5
Note that for 'carbon' 2, I would like it to repeat that it is connected to carbon 1. I was thinking that some permutation would be able to show this, but I am very unsure where to start. Basically, the code needs to output:
for every cell with the same value, print adjacent cell

(a, b)pairs like[(1, 2), (1, 4), (1, 6), (1, 7), (1, 8), (2, 1), (2, 4), (2, 5)], how can I find allbvalues associated with eachavalue?"