How to split DateTime Data to create multiple feature in Python?

This recipe helps you split DateTime Data to create multiple feature in Python
In [1]:
## How to split DateTime Data to create multiple feature in Python 
def Kickstarter_Example_42():
    print()
    print(format('How to split DateTime Data to create multiple features in Python', '*^82'))
    import warnings
    warnings.filterwarnings("ignore")

    # Load library
    import pandas as pd

    # Create data frame
    df = pd.DataFrame()

    # Create dates
    df['date'] = pd.date_range('1/1/2018', periods=5, freq='M')
    print(df)

    # Create features for year, month, day, hour, and minute
    df['year'] = df['date'].dt.year
    df['month'] = df['date'].dt.month
    df['day'] = df['date'].dt.day
    df['hour'] = df['date'].dt.hour
    df['minute'] = df['date'].dt.minute

    # Show three rows
    print()
    print(df.head(3))

Kickstarter_Example_42()
*********How to split DateTime Data to create multiple features in Python*********
        date
0 2018-01-31
1 2018-02-28
2 2018-03-31
3 2018-04-30
4 2018-05-31

        date  year  month  day  hour  minute
0 2018-01-31  2018      1   31     0       0
1 2018-02-28  2018      2   28     0       0
2 2018-03-31  2018      3   31     0       0