Skip to content
Related Articles

Related Articles

Add a Pandas series to another Pandas series
  • Last Updated : 30 Jul, 2020
GeeksforGeeks - Summer Carnival Banner

Let us see how to add a Pandas series to another series in Python. This can be done using 2 ways :

Method 1 : Using the append() function. It appends one series object at the end of another series object and returns an appended series.




# importing the module
import pandas as pd
   
# create 2 series objects
series_1 = pd.Series([2, 4, 6, 8])
series_2 = pd.Series([10, 12, 14, 16])
   
# adding series_2 to series_1 using the append() function
series_1 = series_1.append(series_2, ignore_index = True)
  
# displaying series_1
print(series_1)

Output :

Method 2 : Using the concat() function. It takes a list of series objects that are to be concatenated as an argument and returns a concatenated series.




# importing the module
import pandas as pd
   
# create 2 series objects
series_1 = pd.Series([2, 4, 6, 8])
series_2 = pd.Series([10, 12, 14, 16])
   
# adding series_2 to series_1 using the concat() function
series_1 = pd.concat([series_1, series_2])
  
# displaying series_1
print(series_1)

Output :

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :