I have a dataframe float column as:
data = {'mydate': [23131.0,23131.0,np.nan,22677.0,22554.0,np.nan,23131.0]}
df = pd.DataFrame(data,columns=['mydate'])
mydate
0 23131.0
1 23131.0
2 NaN
3 22677.0
4 22554.0
5 NaN
6 23131.0
It contains null values. I am trying to convert it to datetime python using the following code
def dayym(unit):
dates = {date:((epoch + datetime.timedelta(days=date))) for date in unit.unique()}
return unit.map(dates)
df.loc[:,'mydate']= dayym(df['mydate'])
with the following error:
dates = {date:((epoch + datetime.timedelta(days=date))) for date in unit.unique()}
File "central_read.py", line 18, in <dictcomp>
dates = {date:((epoch + datetime.timedelta(days=date))) for date in unit.unique()}
ValueError: cannot convert float NaN to integer
Any ideas. I am out of them at this point.