My input file:
-150 150 -90 130 1
-150 150 -150 170 1
-150 150 -110 140 1
-150 160 -80 -20 1
-150 170 -140 160 1
-150 170 -70 -40 1
-140 -170 -110 150 1
-140 130 -120 110 1
-140 140 160 -150 1
-140 160 -150 150 1
I need to create a python dictionary so the key is the first two columns and the value is another dictionary where the key has 3 + 4 columns and the value is the 5th column:
'-140 160' : {'-150 150' : 0.0188679245283019},
'-140 -170' : {'-110 150' : 0.0188679245283019},
'-150 170' : {'-140 160' : 0.0188679245283019, '-70 -40' : 0.0188679245283019},
'-150 160' : {'-80 -20' : 0.0188679245283019},
'-150 150' : {'-150 170' : 0.0188679245283019, '-110 140' : 0.0188679245283019}
So far, I have used a perl script to convert it to text that looks like the one shown above, and then copy this text into my Python code. (the value became a fraction because I divided it by the total amount, which was 56
source
share