0

Could you tell me how to resize the array in order? For example:

If the input is:

>>> np.arange(4)
array([0, 1, 2, 3])

The output will be:

array([0, 0, 1, 1, 2, 2, 3, 3])
Mozzie
  • 353
  • 2
  • 12

1 Answers1

0
In [1]: import numpy as np

In [2]: a = np.arange(4)

In [3]: a
Out[3]: array([0, 1, 2, 3])

In [4]: np.repeat(a, 2)
Out[4]: array([0, 0, 1, 1, 2, 2, 3, 3])
one
  • 2,205
  • 1
  • 15
  • 37