我有一個數據幀,看起來像這個附加列個月: CONTRACT_ID START_DATE SERVICE VALUE year month
1 01-01-2018 A 10 2018 1
2 01-01-2018 B 20 2018 1
3 01-01-2018 C 30 2018 1
4 01-03-2018 B 40 2018 3
5 01
我在MATLAB中有這個功能 cn = reshape (repmat (sn, n_rep, 1), 1, []);
與鍵碼號蟒蛇: import numpy like np
from numpy.random import randint
M = 2
N = 2 * 10 ** 8 ### data value
n_rep = 3 ## number of repetitions