Write a python program to show the use of header and tail methods of Series.

Class 12th CBSE IP Write a python program to show the use of header and tail methods of Series. Solution: –  import pandas as pd myDict= {1:’Mannat’,2:’Samidha’,3:’Jai’,4:’Kalk’,5:’Abhishek’,6:’Yuvesh’} print(myDict) mySeries=pd.Series(myDict) print(mySeries) print(mySeries.head(2)) print(mySeries.tail(2)) Fun & Easy to follow Works on all devices Your own Pace Super Affordable Popular Videos https://www.youtube.com/watch?v=9uOETcuFjbE UX for Teams Learn the basics […]

Write a python program to create a Series Object

Class 12th CBSE IP Write a python program to create a Series Object Solution: –  import pandas as pd mySeries = pd.Series([10,20,30]) mySeries1 = pd.Series([10,20,30],index=[5,6,7]) print(mySeries) print(mySeries1) print(mySeries+mySeries) Fun & Easy to follow Works on all devices Your own Pace Super Affordable Popular Videos https://www.youtube.com/watch?v=9uOETcuFjbE UX for Teams Learn the basics and a bit beyond […]

Write a python program to create a DataFrame for examination result and display row labels, column labels data types of each column and the dimensions.

Class 12th CBSE IP Write a python program to create a Data Frame for examination result and display row labels, column labels data types of each column and the dimensions. Solution: –  import pandas as pd df=pd.DataFrame() df[‘Name’]=[‘A’,’B’,’C’,’D’] df[‘Class’]=[12,10,11,12] df[‘Mrks1’]=[88,85,89,90] df[‘Mrks2’]=[55,67,97,87] df[‘Mrks3’]=[77,75,74,73] print(df) print(df[‘Name’].shape) Fun & Easy to follow Works on all devices Your own […]

Write a python program to create a DataFrame quarterly sales where each row contains the item category, item name and expenditure. Group the rows by the category and print the total expenditure per category.

Class 12th CBSE IP Write a python program to create a DataFrame quarterly sales where each row contains the item category, item name and expenditure. Group the rows by the category and print the total expenditure per category. Solution: –  import pandas as pd df=pd.DataFrame() df[‘item category’]=[‘c1′,’c2′,’c3′,’c4’] df[‘item name’]=[‘pen’,’pencil’,’bottle’,’lunchbox’] df[‘expenditure’]=[1000,2000,3000,4000] print(df) p1=df.pivot_table(index=’item category’,values=’expenditure’,aggfunc=sum) print(p1) Fun […]

Write a python program to create a DataFrame for students storing their roll no, name, address, phone and display the DataFrame on the screen.

Class 12th CBSE IP Write a python program to create a DataFrame for students storing their roll no, name, address, phone and display the DataFrame on the screen. Solution: –  import pandas as pd df=pd.DataFrame() df[‘rollno’]=[1,2,3,4,5] df[‘name’]=[‘Bhavika’,’Mansha’,’Kriti’,’Drishti’,’Khushboo’] df[‘address’]=[‘Punjabi Bagh’,’Moti Nagar’,’Ramesh Nagar’,’Kirti Nagar’,’Shadipur’] df[‘phone’]=[2345,4567,8910,1112,1213] print(df) Fun & Easy to follow Works on all devices Your own […]

Given a Series, print all the elements that are above the 75th percentile.

Class 12th CBSE IP Given a Series, print all the elements that are above the 75th percentile. Solution: –  import pandas as pd import numpy as np s=pd.Series(np.array([1,3,4,7,8,8,9])) print(s) res=s.quantile(q=0.75) print() print(’75th Percentile of the series is:::’) print(res) print() print(‘The elements that are above the 75th percentile::’) print(s[s>res]) Fun & Easy to follow Works on […]

Create a pandas series from a dictionary of values and an ndarray.

Class 12th CBSE Create a pandas series from a dictionary of values and an ndarray. Solution: –  import pandas as pd import numpy as np print(“Creating Series using ndarray”) s= pd.Series(np.array([1,2,3,4,5])) print(s) print(“Creating Series using Dictionary”) dict1 ={‘A’:10,’B’:20,’C’:30} s1 = pd.Series(dict1) print(s1) Output Fun & Easy to follow Works on all devices Your own Pace […]

Write SQL commands for the following table Teacher.

Class 12th CBSE CS Write SQL commands for the following table Teacher. Solution: –  Write SQL commands for the following table Teacher. How to Create Database ?    Solution :- Create database School;  Output :-  How to Access Database? Solution :-  use  School Output :-  How to Create table Teacher. Solution :-  Create table Teacher(TID […]

Write a SQL command to Create a Table Hospital.

Class 12th CBSE CS Write a SQL command to Create a Table Hospital. Solution: –  Considered the following table Hospital – > How to create a Database. Solution :-  Create database hospital; -> How to show Databases. Solution :-  show databases; ->How to select database.   Solution :-  use hospital; -> How to Create table […]

sign up!

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