Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to print the days in a given month using Python?
Input −
Assume, you have date series to find the number of days in a month.
Solution
To solve this, we will follow the steps given below −
Define date series
Set date_range value as 2020-02-10.
find the number of days in a month using Series.dt.daysinmonth
Example
Let us see the complete implementation to get a better understanding −
import pandas as pd
date = pd.date_range('2020-02-10',periods=1)
data = pd.Series(date)
print(data.dt.daysinmonth)
Output
0 29
Advertisements
