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

Creating expanded 1D array from 1D array elements without for loop

$
0
0

I want to create an expanded 1D array from elements of 1D array using some numpy operation and without using a for loop. I would essentially read in the elements of 1D array and count up a few numbers(pre-determined value) from it and proceed to the next element to expand. See an example below.

1D array = [1 9 20 56 78 120]

expanded 1D array = [1 2 3 9 10 11 20 21 22 56 57 58 78 79 80 120 121 122]

is this possible? Thank you

I honestly don't have any idea how to do this without using a for loop


Viewing all articles
Browse latest Browse all 23131

Trending Articles



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