Antoine Deleuze
Antoine Deleuze

Reputation: 37

pandas.apply function returns <built-in method

I am trying to convert timestamps to string dates in a dataframe proceeding this way:

def ts_to_date(ts):
    return str(ts.date)

display(table["event_date_and_time"].apply(ts_to_date))

The issue is that the resulting pandas serie is filled with built-in method date of Timestamp object at 0... and not with the converted timestamps. What do I do wrong ?

Thank you in advance

Upvotes: 0

Views: 1645

Answers (1)

GeorgPoe
GeorgPoe

Reputation: 352

You forgot the parantheses after .date :

def ts_to_date(ts):
    return str(ts.date())

Upvotes: 1

Related Questions