3

I'd like to apply a series to the end of a dataframe, but have the same series in each row of the dataframe. Wondering how I can do this? Example below. Thanks!

Dataframe:

   a  b
0  2  3
1  6  5

Series:

var1    foo
var2    bar
dtype: object

Output:

   a  b  var1  var2
0  2  3  foo   bar
1  6  5  foo   bar
nicholas.reichel
  • 2,260
  • 7
  • 20
  • 28

1 Answers1

2

By using assign

df.assign(**s)
Out[354]: 
   a  b var1 var2
0  2  3  foo  bar
1  6  5  foo  bar
BENY
  • 317,841
  • 20
  • 164
  • 234