In NumPy we can find the number of weekdays in a given month with the help of busday_count() In this pass the given month is the first parameter and next month as the second parameter. It will return the total number of weekdays in a given month.
numpy.busday_count(begindates, enddates, weekmask)
begindates: The array of the first dates for counting.
enddates: The array of the end dates for counting, which are excluded from the count themselves.
weekmask: Select the days
Weekdays are from Monday to Friday only.
Number of weekdays in july 2020: 23
Example #2: We can count the number of Sat with this weekmask.
Number of saturday in november 2020: 4
Example #3: Count the number of Sunday.
Number of Sunday in november 2020: 5
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course