How to encode Days of a week in Python?
0

How to encode Days of a week in Python?

This recipe helps you encode Days of a week in Python
In [1]:
## How to encode Days of a week in Python 
def Kickstarter_Example_44():
    print()
    print(format('How to encode Days of a week in Python',
                 '*^82'))

    import warnings
    warnings.filterwarnings("ignore")

    # Load library
    import pandas as pd

    # Create dates
    dates = pd.Series(pd.date_range('11/9/2018', periods=3, freq='M'))

    # View data
    print()
    print(dates)

    # Show days of the week
    print()
    print(dates.dt.weekday_name)

Kickstarter_Example_44()
**********************How to encode Days of a week in Python**********************

0   2018-11-30
1   2018-12-31
2   2019-01-31
dtype: datetime64[ns]

0      Friday
1      Monday
2    Thursday
dtype: object