【发布时间】:2023-02-15 19:18:45
【问题描述】:
当我有一个“DOB”列时,如何包含一个名为“Age_cust”的新列?
from datetime import date
today = date.today()
ddf = ddf.assign(Age_cust=cust.map_partitions(lambda x: x['DOB'] - today))
从这里我得到错误
ValueError: Metadata inference failed in `lambda`.
You have supplied a custom function and Dask is unable to
determine the type of output that that function returns.
To resolve this please provide a meta= keyword.
The docstring of the Dask function you ran should have more information.
Original error is below:
------------------------
TypeError("unsupported operand type(s) for -: 'DatetimeArray' and 'datetime.date'")
【问题讨论】: