#!/usr/bin/env python
"""
Implement help functions
"""
import pandas as pd
import numpy as np


def delta_date_feature(dates):
    """
    Given a 2d array containing dates (in any format recognized by
    pd.to_datetime), it returns the delta in days between each date and the
    most recent date in its column
    """
    date_sanitized = pd.DataFrame(dates).apply(pd.to_datetime)
    return (date_sanitized
            .apply(lambda d: (d.max() - d).dt.days, axis=0)
            .to_numpy())
