开发者

numpy join entries intersecting at a cell

In numpy, how can I join the entries that intersects at a cell?

For example: Example http://img153.imageshack.us/img153/5162/matd.png

In the example, I want to join rows/columns B and F into one row/column BF, where each element is the average of the ones with t开发者_JAVA百科he same color.


What you want to do doesn't seem straightforward from a matrix point of view so doing in a "pure numpy" manner is likely unfeasible.

I'd probably break it up into 2 or 3 operations:

  1. Pull out row F, transpose it and average it with column B.
  2. Take the first value of the row F you pulled out and average it with the first value of row B.
  3. Pull out column F and average it with column B.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜