我正在尝试从pandas数据框中提取列值,但输出也包括索引和数据类型。代码在下面给出
for index, row in df_count_unique3.iterrows():
policy_number = []
for value in row['p_number']:
print(value)
value = PC_number[(PC_number.p_number1 == value)&(PC_number.PRole == "AccountHolder")]
policy_number.append(value['policy_number'])
PC_policy2['policy_number'] = policy_number
Output of PC_policy2
policy_number
2842824 P129487971 Name: policy_number, dtype..
Expected output:
policy_number
P129487971
任何建议都会很棒。
答案 0 :(得分:1)
print(df_count_unique3.to_string(index=False))