Q:

Write a Pandas program to create a TimeSeries to display all the Sundays of given year

0

Write a Pandas program to create a TimeSeries to display all the Sundays of given year

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
result = pd.Series(pd.date_range('2020-01-01', periods=52, freq='W-SUN'))
print("All Sundays of 2019:")
print(result)

Sample Output:

All Sundays of 2019:
0    2020-01-05
1    2020-01-12
2    2020-01-19
3    2020-01-26
4    2020-02-02
5    2020-02-09
6    2020-02-16
7    2020-02-23
8    2020-03-01
9    2020-03-08
10   2020-03-15
11   2020-03-22
12   2020-03-29
13   2020-04-05
14   2020-04-12
15   2020-04-19
16   2020-04-26
17   2020-05-03
18   2020-05-10
19   2020-05-17
20   2020-05-24
21   2020-05-31
22   2020-06-07
23   2020-06-14
24   2020-06-21
25   2020-06-28
26   2020-07-05
27   2020-07-12
28   2020-07-19
29   2020-07-26
30   2020-08-02
31   2020-08-09
32   2020-08-16
33   2020-08-23
34   2020-08-30
35   2020-09-06
36   2020-09-13
37   2020-09-20
38   2020-09-27
39   2020-10-04
40   2020-10-11
41   2020-10-18
42   2020-10-25
43   2020-11-01
44   2020-11-08
45   2020-11-15
46   2020-11-22
47   2020-11-29
48   2020-12-06
49   2020-12-13
50   2020-12-20
51   2020-12-27
dtype: datetime64[ns

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now