Note

Pandas (30) 본문

Pandas

Pandas (30)

알 수 없는 사용자 2022. 8. 22. 19:09
728x90

How to create a TimeSeries starting ‘2000-01-01’ and 10 weekends (saturdays) after that having random numbers as values?

# Solution
ser = pd.Series(np.random.randint(1,10,10), pd.date_range('2000-01-01', periods=10, freq='W-SAT'))
ser

# output
2000-01-01    6
2000-01-08    7
2000-01-15    4
2000-01-22    6
2000-01-29    8
2000-02-05    6
2000-02-12    5
2000-02-19    8
2000-02-26    1
2000-03-04    7
Freq: W-SAT, dtype: int64

'Pandas' 카테고리의 다른 글

Pandas (32)  (0) 2022.08.24
Pandas (31)  (0) 2022.08.23
Pandas (29)  (0) 2022.08.21
Pandas (28)  (0) 2022.08.20
Pandas (27)  (0) 2022.08.19
Comments