python_datafram两列拼接,中间加上特殊字符 t10 [ 'temp' ] = t10 [ 'date' ]. apply ( lambda x : x + ':' ) t10 [ 'temp' ]. head () t10 [ 'user_date_datereceived_gap' ] = t10 [ 'temp' ] + t10 [ 'date_received' ] t10 [ 'user_date_da
python_datafram两列拼接,中间加上特殊字符
t10['temp'] = t10['date'].apply(lambda x: x+ ':')t10['temp'].head()
t10['user_date_datereceived_gap'] = t10['temp'] + t10['date_received']
t10['user_date_datereceived_gap'].head()
#方法二:
t10['user_date_datereceived_gap']=t10.apply(lambda x: x['date']+ ':'+ x['date'],axis=1)
t10['user_date_datereceived_gap'].head()
#日期中间用横线拼接,有事拼接不成功,可能是由于类型不一样
#注意这里所有的时间格式都已经是'str'格式
print(t7)
t7['date_received_date'] = t7.Date_received.astype('str')+'-'+t7.dates
效果: