gpt4 book ai didi

python - 属性错误 : 'Series' object has no attribute 'value'

转载 作者:行者123 更新时间:2023-12-05 00:56:57 30 4
gpt4 key购买 nike

我正在尝试获取电话号码列表

这里是代码

response='108'
group="MAMA"
optout='False'

phone_numbers = merged_df.loc[(merged_df['Facility Code'] ==facility_number) & (merged_df['group'] == group) & (merged_df['Optedout'] == optout)]['phone'].values
print(phone_numbers)

我的数据框看起来像这样

phone       group   County  PNC/ANC Facility Name   Optedout    Facility Code
25470000000 MAMA Orange PNC Main Centre FALSE 112
25470000000 MAMA Orange PNC Main Centre FALSE 112
25470000010 MAMA Orange PNC Centre FALSE 108
25470000020 MAMA Orange PNC Centre FALSE 108
25470000000 MAMA Orange PNC Main Centre FALSE 112

这是我得到的错误

AttributeError: 'Series' object has no attribute 'value'

想要的输出

[25470000010,25470000020]

我似乎无法弄清楚我做错了什么。请帮我解决这个问题

最佳答案

你需要删除.values:

phone_numbers = merged_df.loc[(merged_df['Facility Code'] ==facility_number) & (merged_df['group'] == group) & (merged_df['Optedout'] == optout)]['phone']

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

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com