I have a DataFrame which has an open time and a close time and I am trying to calculate the difference in milliseconds.
My code is currently like this
df = df.assign(Latency=lambda d: d.CloseTimeStamp - d.CreationTimeStamp)
df.Latency = df.apply(lambda d: d.Latency.total_seconds() * 1000., axis=1)
However, I'd like to know why I can't do as a one-liner like so
df = df.assign(Latency=lambda d: (d.CloseTimeStamp - d.CreationTimeStamp).total_seconds() * 1000.)
When I try the latter I get AttributeError: 'Series' object has no attribute 'total_seconds'