I have a dataframe in pandas with mixed int and str data columns. I want to combine the columns in the data frame first. To do this, I need to convert the int column to str . I tried to do the following:
mtrx['X.3'] = mtrx.to_string(columns = ['X.3'])
or
mtrx['X.3'] = mtrx['X.3'].astype(str)
but in both cases this does not work, and I get the error message "it is not possible to combine str and int objects". Joining two str columns works fine.
python string pandas int dataframe
Malfet Jul 30 '13 at 14:53 2013-07-30 14:53
source share