这个错误是由于尝试将datetime.time对象转换为float类型引起的。要解决这个问题,需要在使用datetime.time对象之前将其转换为float类型或字符串类型。

一种可能的解决方法是使用datetime.time对象的strftime()方法将其转换为字符串类型,然后将字符串类型转换为float类型。例如:

x1 = [datetime.time(10, 0), datetime.time(11, 0), datetime.time(12, 0)] y1 = [1, 2, 3]

x1_str = [t.strftime('%H:%M:%S') for t in x1] x1_float = [float(t) for t in x1_str]

plt.plot(x1_float, y1)

这将使用strftime()方法将datetime.time对象转换为字符串类型,然后使用float()函数将其转换为float类型。您可以将此代码片段放入parse_device_data_file函数中的plt.plot(x1, y1)之前。

INFO 2023-05-18 151933541 performancepy parse_device_data_file 138 Traceback most recent call last File testios-uitestperformancepy line 129 in parse_device_data_file pltplotx1 y1 File us

原文地址: https://www.cveoy.top/t/topic/fibt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录