Pandas中数据错误的规范化

2024-04-19 12:59:27 发布

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

当我试图在jupyter笔记本中运行以下命令时,在规范化数据方面出现了一个问题。代码下面是我收到的错误信息。你知道吗

代码:

groupByGender_df = purchase_data_df.groupby([‘Gender’])
gender = purchase_data_df[“Gender”].value_counts()

groupByGender_df[“Price”].sum(),
                           “Normalized Price”: groupByGender_df[“Price”].mean().value_counts(normalize=True)})
summaryTable.head()

错误消息:

RuntimeWarning: ‘<’ not supported between instances of ‘str’ and ‘float’, sort order is undefined for incomparable objects
 result = result.union(other)

RuntimeWarning: ‘<’ not supported between instances of ‘float’ and ‘str’, sort order is undefined for incomparable objects
 index = _union_indexes(indexes)

我认为这与我试图组合两个数据帧有关?但我不确定。你知道吗


Tags: 数据instances代码dfdatavaluenotbetween