Answers for "how to join two string series python"

0

how to join two string series python

series.str.cat is the most flexible way to approach this problem:

For df = pd.DataFrame({'foo':['a','b','c'], 'bar':[1, 2, 3]})

df.foo.str.cat(df.bar.astype(str), sep=' is ')

>>>  0    a is 1
     1    b is 2
     2    c is 3
     Name: foo, dtype: object
Posted by: Guest on February-12-2022

Python Answers by Framework

Browse Popular Code Answers by Language