Class 12th CBSE IP

Write a python program to show the use of where condition using Series.

Solution: – 

import pandas as pd myDict= {1:10,2:20,3:30} myDict2= {1:'Ajay',2:'Dheeraj',3:'Shanku'} print(myDict) mySeries=pd.Series(myDict) mySeries2=pd.Series(myDict2) print(mySeries) print(mySeries.where(mySeries > 10)) print(mySeries.where(mySeries < 20)) print(mySeries.where(mySeries == 10)) print(mySeries.where(mySeries == 10,33)) print(mySeries.where(mySeries != 10,33)) print(mySeries2) print(mySeries2.where(mySeries2 == 'Ajay')) print(mySeries2.where(mySeries2 != 'Ajay')) print(mySeries2.where(mySeries2 == 'Ajay','Akshay'))

Fun & Easy to follow
Works on all devices
Your own Pace
Super Affordable

Popular Videos

UX for Teams

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

SEO & Instagram

Learn the basics and a bit beyond to improve your backend dev skills.

ava4.png
Chris Matthews

Designer

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.