Professional Documents
Culture Documents
Ip 30
Ip 30
Q.Write a Pandas program to compare the elements of the two pandas series?
Ans:-
print(a<b) 1 False
2 False
3 False
dtype: bool
Elements of A less than B
0 False
1 False
2 False
3 True
dtype:bool
PROGRAM-6
Q. Write a Pandas program to add, subtract, multiple and divide two Pandas Series
Ans:- CODE PROGRAMMING
import pandas as pd Output:-
a=pd.Series([1,2,3,4]) PROGRAM-6
Q. Write a Pandas program to add, subtract, multiple and divide two Pandas Series
Ans:- CODE PROGRAMMING
import pandas as pd Output:-
a=pd.Series([1,2,3,4]) Addition
b=pd.Series([10,20,30,40]) 0 11
print("Addition") 1 22
print(a+b) 2 33
print("Subtraction") 3 44
print(a-b) dtype: int64
print("Division") Subtraction
print(a/b) 0 -9
print("Multiplication") 1 -18
print(a*b) 2 -27
3 -36
dtype: int64
Division
0 0.1
1 0.1
2 0.1
3 0.1
dtype: float64
Multiplication
0 10
1 40
2 90
3 160
dtype: float64