If I have a DataFrame :
students = pd.DataFrame([ ['Alex'], ['Lauren'], ])
How can I combine a Series and create a new DataFrame ? For example, I would like to:
>>> marks = pd.Series([.8, .75]) >>> students.concat(marks).values [['Alex', .8], ['Lauren', .75]]
I know I can use:
students['marks'] = marks
But this will mutate the students .
I tried:
>>> pd.concat([students, marks]) β¦ AttributeError: 'Series' object has no attribute '_data'
source share