|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
统计Dataframe中超市那行出现的每个元素的数量
再把前30的数量加起来。
源码
shuliang=hang['超市'].value_counts()
zongshu = sum(shuliang[:30])
出现警告:
E:\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_utils.py:605: FutureWarning: The behavior of `series[i:j]` with an integer-dtype index is deprecated. In a future version, this will be treated as *label-based* indexing, consistent with e.g. `series[i]` lookups. To retain the old behavior, use `series.iloc[i:j]`. To get the future behavior, use `series.loc[i:j]`.
s = s[:max_items]
E:\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_utils.py:606: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
for item in s.iteritems():
这代码该怎么改才能不出现红色的提醒。 |
|