Professional Documents
Culture Documents
GRADE- XII
INFORMATICS PRACTICES LAB MANUAL
2022-2023
PYTHON & MYSQL
1. Write a program to create Pandas series from dictionary of values and nd array.
Program Logic:
Output:
Output:
2. Write a program to generate a series of float numbers from 41.0 to 60.0 with an increment of
2.5.
3. Write a program to generate a series of 10 numbers with a scalar value of 44.
4. Write a program to create Pandas DataFrame from dictionary of values and Series.
5. Write a Pandas program to count the number of rows and columns of a Data Frame.
Program Logic:
Output:
Program Logic:
7. Write a program to create data frame for examination result and display row labels, column
labels data types of each column and the dimensions.
Program Logic:
OUTPUT:
8. Create the following DataFrame Sales containing year wise sales figures for five salespersons
in INR. Use the years as column labels, and salesperson names as row labels.
Source Code:
import pandas as pd
data = [["Virat",55,66,31],["Rohit",88,66,43],["Hardik",99,101,68]]
print("Iterating by rows:")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print(index, row.values)
print("Iterating by columns:")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print(index, row["Name"],row["Match-1"],row["Match-2"],row["Match-3"])
OUTPUT:
10. Create a dataframe and print it along with their index using iteritems().
SOURCE CODE:
import pandas as pd
def df_operations():
df=pd.DataFrame(sc_4yrs)
print(df)
print("------------------------------------------------------------------------")
print("Year:",year)
print(runs)
df_operations()
OUTPUT:
11. Consider the dataframe and write code using tail(),loc & iloc to do the following:
a. Display the last two rows of Sales.
b. Display the first two columns of Sales.
12. Create a dataframe using the dictionary “result” given below and write code using
head(),loc & iloc to do the following:
Program Logic:
14. Write a program to import data between pandas and CSV file with Practical Example
Program Logic:
15. Write a program to analyze the performance of student on different parameters subject
wise or class wise from the given school result data.
Program Logic:
3. Create table loan_accounts ,Loan_details and insert the appropriate tuples in it.
LOAN_ACCOUNTS
LOAN_DETAILS
1 RANVEER PERSONAL
2 RAHUL VEHICLE
3 HARSHITH PERSONAL
4 SHINY HOME
5 REHA HOME
6 REACHAL VEHICLE
7 ABIJITH VEHICLE
7. Display the accno and loan_amount of all the loans started before 01-04-2009.
9. Display the details of all the loans whose rate of interest is null.
10.Display the amount of various loans from the table loan_accounts. A loan amount should
appear only once.
11.Display the cust_name and loan_amount for all the loans which do not have number of
installments 36.
12.Display the cust_name and loan_amount for all the loans for which the loan amount is less
than 500000 or int_rate is more than 12.
13.Display the details of all the loans whose rate of interest is in the range 11% to 12%.
14.Display the cust_name and loan_amount for all the loans for which the number of
installments are24, 36, or 48.
15.Display the details of all the loans whose loan_amount is in the range 400000 to 500000.
16.Display the accno, cust_name, loan_amount for all the loans for which the cust_name ends
with “Sharma”.
17.Display the accno, cust_name, and loan_amount for all the loans for which the cust_name
contains ‘a’ as the second last character.
18.Display the details of all the loans in the ascending order of their loan_amount.
19.Display the details of all the loans in the descending order of theirstart_date.
20.Put the interest rate 11.50% for all the loans for which interest rate is null.