简体   繁体   中英

python - access all dictionary elements not corresponding to key

I'm trying to write code to compute pairwise differences in a bunch of data within and between groups. That is, I've loaded the data into a dictionary so that the ith value of data j in group k is accessible by

data[j][group[k]][i]

I've written for loops to calculate all of the within group pairwise differences, but I'm a little stuck on how to then calculate the between groups pairwise differences. Is there a way to compare all of the values in data[j][group[k]] to all of the values in data[j][*NOT*group[k]] ? Thanks for any suggestions.

You Could compare them all and then throw out the ones where the group is the same as the one being compared to. (I hope that makes sense)

Or

make a temporary group[l] equal to group[k] minus the instance you are comparing to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM