Pandas: `item` has been deprecated

前端 未结 5 1483
情书的邮戳
情书的邮戳 2020-12-17 14:50

So far I used this line of code here:

max_total_gross = event_data[\"max_total_gross\"].loc[event_data[\"event_id\"] == event_id].item()

Si

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 15:21

    It has been undeprecated again in pandas 1.0 for exactly this use case:

    Series.item() and Index.item() have been undeprecated (GH29250)

    from https://pandas.pydata.org/docs/whatsnew/v1.0.0.html#deprecations. See also discussion in the issue GH29250.

    So consider updating or ignoring or silencing the warning instead.

提交回复
热议问题