api.py:87:RuntimeWarning:“str”和“int”的实例之间不支持“<”,未定义不可比较对象的排序顺序

2024-10-04 05:23:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望生成一个DataDrame,用于训练随机林,方法是调用:

stats_cpu_primitive=pd.concat([stats_user['datetime'], dayofweek, stats_user['user_value'], stats_system['system_value'], stats_wait['wait_value'], stats_nice['nice_value'], stats_interrupt['interrupt_value'], stats_softirq['softirq_value'], stats_steal['steal_value'], stats_idle['idle_value']], axis=1)

然后我得到:

D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pandas\core\indexes\api.py:87: RuntimeWarning: '<' not supported between instances of 'str' and 'int', sort order is undefined for incomparable objects result = result.union(other) D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pandas\core\indexes\api.py:57: RuntimeWarning: '<' not supported between instances of 'int' and 'str', sort order is undefined for incomparable objects union = _union_indexes(indexes)

相应地,dayofweek列中的元素都是nan。 但我没有进行任何“比较”相关操作。我负责。打电话,dayofweek.dtype是float64,stats\u user['datetime'],dtype是str,左边都是int64。然而,即使我执行astype()来传输stats_user['datetime'].dtype和dayofweek为int64,我得到了相同的结果。在

怎么处理?非常感谢。在


Tags: datetimevaluestatssystemniceunionwaitdtype