I am trying to read some data but the column names are repeatedly coming.
Here is a sample code:
for i in range(1, len(df_A2C), 1):
A2C_TT= df_A2C.loc[(df_A2C['TO_ID'] == i)].sort_values('DURATION_H').head(1)
if A2C_TT.size > 0:
print (A2C_TT)
Output:
I do not need column names. What should I do?
CodePudding user response:
You may simply call the values
method after head
:
for i in range(1, len(df_A2C), 1):
A2C_TT= df_A2C.loc[(df_A2C['TO_ID'] == i)].sort_values('DURATION_H').head(1).values
if A2C_TT.size > 0:
print (A2C_TT)