﻿ Pandas Data Series: Create a TimeSeries to display all the Sundays of given year - w3resource

# Pandas Data Series: Create a TimeSeries to display all the Sundays of given year

## Pandas: Data Series Exercise-35 with Solution

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

Sample Solution :

Python Code :

``````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]
```

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Returns a list with n elements removed from the beginning

Example:

```def tips_take(itr, n = 1):
return itr[:n]
print(tips_take([1, 2, 3], 5))
print(tips_take([1, 2, 3], 0))
```

Output:

```[1, 2, 3]
[]
```