Program to add two series

In this python pandas program, we will add two series using pandas.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create two series using pd.Series().
  3. Now add the two series using the” + ” operator.
  4. Print the output.
				
					import pandas as pd
df1 = pd.Series([1,6,9,5])
df2 = pd.Series([5,2,4,5])
print(df1+df2)
				
			

Output :

				
					0     6
1     8
2    13
3    10
dtype: int64
				
			

convert a series to a list and print its type

subtract two series

Leave a Comment