user3447653
user3447653

Reputation: 4158

Get the column value from pandas dataframe without the index

I am trying to extract the column values from pandas dataframe but the output includes index and datatype as well. The code is given below

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

Any suggestions would be great.

Upvotes: 2

Views: 3987

Answers (1)

Mayank Porwal
Mayank Porwal

Reputation: 34086

print(df_count_unique3.to_string(index=False))

Upvotes: 2

Related Questions