import re
from datetime import datetime


def format_date(row):
    """ Extracts the unix timestamp from the string and converts it to a datetime object, best if used with map
    :param row: row from a dataframe """
    row=str(row)
    unix = [int(s) for s in re.findall(r'-?\d+\.?\d*', row)]
    dt_object = datetime.fromtimestamp(unix[0]/1000)
    return(dt_object)