How to encode ordinal categorical features in Python?

This recipe helps you encode ordinal categorical features in Python
In [1]:
## How to encode ordinal categorical features in Python 
def Kickstarter_Example_31():
    print()
    print(format('How to encode ordinal categorical features in Python', '*^82'))

    import warnings
    warnings.filterwarnings("ignore")

    # Load library
    import pandas as pd

    # Create features
    df = pd.DataFrame({'Score': ['Low', 'Low', 'Medium', 'Medium', 'High']})

    # View data frame
    print(); print(df)

    # Create Scale Map
    scale_mapper = {'Low':1, 'Medium':2, 'High':3}

    # Map feature values to scale
    df['Scale'] = df['Score'].replace(scale_mapper)

    # View data frame
    print(); print(df)

Kickstarter_Example_31()
***************How to encode ordinal categorical features in Python***************

    Score
0     Low
1     Low
2  Medium
3  Medium
4    High

    Score  Scale
0     Low      1
1     Low      1
2  Medium      2
3  Medium      2
4    High      3