Skip to main content
Notice removed Draw attention by user2285236
Bounty Ended with mozway's answer chosen by CommunityBot
Notice added Draw attention by user2285236
Bounty Started worth 500 reputation by CommunityBot
added 6 characters in body
Source Link
hpaulj
  • 233.3k
  • 14
  • 262
  • 394

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: The array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

4 elt sample0, 4 elt sample 1, 4 elt  sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

My array has 499875840 elements !

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: The array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

My array has 499875840 elements !

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: The array can have up to 3 interleave sub-array of 4 elements

4 elt sample0, 4 elt sample 1, 4 elt  sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

My array has 499875840 elements !

added 37 characters in body
Source Link
sleli
  • 79
  • 5

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: theThe array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

My array has 499875840 elements !

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: the array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: The array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

My array has 499875840 elements !

added 209 characters in body
Source Link
sleli
  • 79
  • 5

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: the array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

Suppose I have a numpy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], How do I take 4 elements every 8 elements). Here is the expected result:

a -> [1,2,3,4, 9,10,11,12]
b -> [5,6,7,8, 13,14,15,16]

My array has hundreds of elements. I went through the numpy array documentation but I never succeeded to perform this computation other then a loop which is very slow.

EDIT: the array can have up to 3 interleave sub-array of 4 elements 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2, 4 elt sample0, 4 elt sample 1, 4 elt sample2 ...

deleted 1 character in body
Source Link
sleli
  • 79
  • 5
Loading
Source Link
sleli
  • 79
  • 5
Loading