I have a dataframe
City hits
A 10
B 1
C 22
D 122
E 1
F 165
I want to make a dataframe with a single column called Hit_ID, whose rows are
A_1
A_2
etc.
A_10
B_1
C_1
C_2
etc.
D_124
D_125
E_1
I tried
df['Hit_ID'] = df[['City','hits']].apply(lambda x:'_'.join(x.astype(str)),axis=1)
but this just concatenates the columns. How can I modify the apply function to get the desired op?