How to repeat a number from 1 to 10000 5 times [duplicate]
I'm using numpy.
I want to repeat numbers from 0 to 10000 five times.
Let me show you a simple example below.
0
0
0
0
0
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
9999
9999
9999
9999
9999
10000
10000
10000
10000
10000
How can I do this?
Use numpy.repeat
with numpy.arange
:
a = np.repeat(np.arange(10001), 5)
print (a)
[ 0 0 0 ... 10000 10000 10000]