python - “不再支持将列表喜欢传递给带有任何缺失标签的 .loc 或 []。缺少以下标签:Index([5], dtype='object')
问题描述
我正在尝试执行前 5 个预算,但出现错误。如何解决这个问题?
def best_worst(n, by, ascending = False, min_bud = 0, min_votes = 0):
df2 = movie_best.loc[(movie_best.Budget>= min_bud) & (movie_best.Votes >= min_votes),
[n, by]].sort_values(by = by, ascending = ascending).head(n).copy()
return HTML(df2.to_html(escape=False))
best_worst(5,"Budget_MUSD")
解决方案
推荐阅读
- r - 当函数嵌套时,如何使用 lapply 或 sapply 在三个不同的 DF 上进行 boostraping 或 KM 计算?
- node.js - Solana 糖果机使用 metaplex / yarn install / node-gyp 错误?
- flutter - 如何在 Flutter 中使用 StreamBuilder 为类似聊天的应用程序监听新数据
- laravel - 在 Laravel 8 中成功登录后我在哪里运行代码?
- reactjs - 如何将 Cloudfront 和 S3 设置为指向每条路由的 index.html?
- codeigniter - 如何在 CodeIgniter 4 中多次渲染部分?
- angular - 在根脚本文件角度中找不到 404
- c++ - 如何使用 C++ 套接字编程同时向多个服务器发送数据?
- mysql - mysql查找聚合表的每条记录来自哪个子表
- node.js - @tensorflow/tfjs-node 在 windows 系统中安装失败