0

I am stuck into converting 2 column values into single one. The data frame df1 I have is:

HR  MM  SS  X
00  00  00  1
02  00  00  2
03  00  00  3

I want to convert this column into

time      
00:00:00
02:00:00
03:00:00

and then concatenate it with another data frame df2 having time(H:M)

Ey   time
96   0:0
75   2:0
80   3:0

with same column value, such that output looks like

time    Ey     X
00:00   96     1
02:00   75     2
03:00   80     3

I tried

df1['time'] = df1[['HR', 'MN']].agg(':'.join, axis=1)
df_122=pd.merge(df1, df2, on='time', how='outer')
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Peculiar
  • 1
  • 1

0 Answers0