I have datetime data which is of the following shape:
yyyy-mm-dd hh:minmin:secsec + hh:minmin
For example this one: 2020-02-01 01:00:00+01:00
I now would like to convert it to float. I used the function I found the solution of this question: python datetime to float with millisecond precision
def datetime_to_float(d):
return d.timestamp()
I applied this function to my datetime-object with this code:
time_in_float = []
for i in time:
time_in_float.append(i.datetime_to_float())
And got this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-f6272033e480> in <module>()
2
3 for i in time:
----> 4 time_in_float.append(i.datetime_to_float())
5
AttributeError: 'datetime.datetime' object has no attribute 'datetime_to_float'
What do I have to change here?
Thanks a lot!