Recipe: How to encode Days of a week in Python?
DATA MUNGING DATA CLEANING PYTHON

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


Stuck at work?
Can't find the recipe you are looking for. Let us know and we will find an expert to create the recipe for you. Click here
Companies using this Recipe
2 developers from Infosys
1 developer from HvH
1 developer from Megasoft
1 developer from Vodafone
1 developer from Altimetrik
1 developer from MSI Services
1 developer from YASH Technologies
1 developer from ANAC
1 developer from KPMG
1 developer from MudraCircle