python - 属性错误: 'tuple' object has no attribute for the code below

标签 python pandas attributes

我是编程和Python新手。您能帮我解决这个错误的原因吗?我已在下面列出了错误。

代码-

country_data_complete = country_data_complete.drop(columns=["City_y", "Host_Country"]),

country_data_complete = country_data_complete.rename({'City_x':'Host_City', 'wb_country_code':'Country_code', 'No. of Atheletes':'No_of_Athelets','Medal':'Total', 'Country':'Country_Name'})

country_data_complete.head()

错误-

AttributeError: 'tuple' object has no attribute 'rename'

最佳答案

第一行末尾有一个逗号 (,)。不应该存在=p

关于python - 属性错误: 'tuple' object has no attribute for the code below,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63412402/

相关文章:

python - 按每组中小于最大值 80% 的值对 pandas 数据框进行子集化。如何?

python - 如何使用 Python 形成文件夹图表

f# - 是否可以在 F# 中为递归类定义不同的属性

python - Powershell将IP地址转换为整数

python - 使用命令行参数将一个文件的非常基本的副本写入另一个文件

python - pd.merge_asof 每个时间段有多个匹配项?

Javascript 性能 : Variable vs Large object's attribute

ruby-on-rails - FactoryGirl 和 Rspec 测试中 attributes_for 的含义

python - 安装 MySQL-python

python - sklearn 的 accuracy_score 函数的类型错误