I have a dynamic plot, in which I'm receiving remote data. I'm now gathering some latencies to a txt file, and I'm updating the mean latency every time new data comes in. My function who does this is:
def calc_latenc():
global average
lista = []
with open('latenciaEdge.txt', 'r') as file:
last10 = deque(file, 10)
for item in last10:
lista.append(item.rstrip())
average = pd.Series(pd.to_timedelta(lista).mean())
The displaying in my figure comes from:
calc_latenc()
ax1.set_xlabel('Latência Média : {} segundos'.format(average), fontsize = 9)
The output comes in this form:
0 00:00:49.460746
dtype: timedelta64[ns]
and I can't seem to format this as I want. The "dtype.." seems imutable. Not even transforming in to string and try cutting the edges seems to work. The ideia is to display only the "HH:MM:SS".
Thanks in advance!