Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23189

Mapping a numpy matrix to a matrix of character strings

$
0
0

I have digital matrix consisting of 0s and 1s. Example:

p=[[1 0 0 1 0]   [0 0 0 0 0]   ...   [1 1 1 1 1]   [0 0 0 1 1]]

The rows of this numpy matrix signify time separated measurements of 5 element bursts of data. Each column signifies the channel of the measurement:

channels=[A B C D E]

I need to map channels on to p so I get:

q=[[A None None D None]   [None None None None None]   ...   [A B C D E]   [None None None D E]]

What is the most pythonic way to map p to q?


Viewing all articles
Browse latest Browse all 23189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>