Python is a very popular language because it is suitable for almost any type of data science task. And Pandas is one of the popular python-based data analysis toolkits and also provides pandas.bdate_range() function to return a fixed frequency DatetimeIndex. This function Returns a fixed frequency DatetimeIndex, with the business day(Mon to Fri) as the default frequency.
Syntax: pandas.bdate_range(start=None, end=None, periods=None, freq=’B’, tz=None, normalize=True, name=None, weekmask=None, holidays=None, closed=None, **kwargs)
start : string or datetime-like, default None.
end : string or datetime-like, default None.
periods : integer, default None.
freq : string or DateOffset, default ‘B’ (business daily).
tz : string or None.
normalize : bool, default False
name : str, default None
weekmask : str or None, default None
holidays : list-like or None, default None
- Import the Pandas module
- Create a Parameter function that returns a boolean value
- Check the given date is returning boolean with pd.bdate_range() inside function
- Check if boolean is False then the date belongs to a weekday if boolean is true then is not weekday
Below is the implementation.
This is your working day This is weekend
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