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 […]

Write a SQL Query to create a Bank Account.

Class 12th CBSE CS Write a SQL Query to create a Bank Account. Solution: –  Table :-    -> How to Create database Bank Solution :-  Create database Bank;   -> Access database. Solution :-  use Bank; -> How to Create a Table. Solution Create table Bank(AccNo int primary key not null,Cust_name varchar(100)not null,FD_amount int […]

Create a Database Student and Stream with following queries.

Class 12th CBSE CS Create a Database Student and Stream with following queries. Solution: –  -> How to create database Student_Stream. Solution :-  create database Student_steam; Output :-  -> Access the database Student_steam. Solution :-  use Student_steam; Output :- -> Create table Student.   Solution : – create table Student(admno int not null,sname varchar(100)not null,class […]

Write a SQL query to create a table Student.

Class 12th CBSE CS Write a SQL query to create a table Student.. Solution: –  Write a SQL query to create a table Student How to create a database Student.  Solution : – Create database Student; Output :-  – > Select Database use Student ; How to create table Student? Solution :-  Create table Student(No […]

sign up!

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