nicholas.reichel
nicholas.reichel

Reputation: 2270

Apply series as row to pandas dataframe with same series in all rows

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

Upvotes: 3

Views: 109

Answers (1)

BENY
BENY

Reputation: 323226

By using assign

df.assign(**s)
Out[354]: 
   a  b var1 var2
0  2  3  foo  bar
1  6  5  foo  bar

Upvotes: 2

Related Questions