Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Ip Questions for Python and Mysql

Rating
-
Sold
-
Pages
44
Grade
A
Uploaded on
17-04-2024
Written in
2023/2024

It has many questions for python and MySQL which will come for examination

Institution
Course

Content preview

INDEX
SL.NO. DATE PROGRAM PG.NO REMARKS
A PANDAS SERIES
1 Create a Series from ndarray 2
and a dictionary of values
2 Series to display the amount of 3
sales made by salesperson
3 Updating existing values of 4
Series
4 Display Series objects using 6
iloc, loc and slicing
5 Attributes of Series objects 8
6 Mathematical operations on 9
Series

B PANDAS DATAFRAME
7 Create and display a 11
DataFrame
8 Accessing values of rows and 14
columns of a DataFrame
9 Inserting column and deleting 16
row from a DataFrame
10 Rename ,count, update and 18
replace operations on
DataFrame
11 Display the attributes of the 21
DataFrame
12 Iterations on DataFrame 22
13 Writing and reading 24
operations in a csv file

C MATPLOTLIB
14 Multiple line chart 25
15 Bar chart 26
16 Multiple bar chart from CSV 27
file
17 Histogram 28

D MYSQL 30




1

,P1. Create a series from ndarray and a dictionary of values

SOURCE CODE:
import pandas as pd
import numpy as np
si=pd.Series(np.array([23,34,45,67,78]))
print('series from ndarray')
print(si)
d1={'niya':25,'neha':24,'krishna':23,'ashmit':22}
s2=pd.Series(d1)
print("series using dictionary")
print(s2)

OUTPUT:
series from ndarray
0 23
1 34
2 45
3 67
4 78
dtype: int32
series using dictionary
niya 25
neha 24
krishna 23
ashmit 22
dtype: int64




2

,P2. Create a series to store the amount of sales made by a salesperson for the last
year(whole month)
a. display the sales amount which is greater than 10000
b. display the sales amount in the first four months
c. display the sales amount in the last four months

SOURCE CODE:
import pandas as pd
amount=[20000,10000,15000,22000,8000,5000,2000,22000,1000,3000,20000,10000]
months=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']
s1=pd.Series(data=amount,index=months)
print('sales amount>10000')
print(s1[s1>10000])
print('sales amount for the first four months')
print(s1.head(4)
print("sales amount for the last months")
print(s1.tail(4))

OUTPUT:
sales amount>10000
jan 20000
mar 15000
apr 22000
aug 22000
nov 20000
dtype: int64
sales amount for the first four months
jan 20000
feb 10000
mar 15000
apr 22000
dtype: int64
sales amount for the last months
sep 1000
oct 3000
nov 20000
dec 10000
dtype: int64


3

, P3. To write a python program to create a series object with employee names as the
index and their salaries as values accept the name of the employee whose salary
needs to be changed, along with the new salary,update it in the series.

SOURCE CODE:
import pandas as pd
D={'jhon':50000,'bala':60000,'anu':55000,'birundha':52000}
s=pd.Series(D)
print("employees salary before updating")
print(s)
print("\n")
opt=input("do you want to update the salary of the employee (y/n)?:")
if opt=='y':
name=input("enter the name of the employee:")
if name in s:
new_salary =float(input("enter the new salary:"))
s[name] = new_salary
print("\n salary updated succesfully")
print("\n employees salary after updating")
print(s)
else:
print("\n employee not found in the records.")
else:
print("\n thank you!!!")




4

Written for

Institution
Secondary school
Course
School year
2

Document information

Uploaded on
April 17, 2024
Number of pages
44
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$8.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
joeljohnsaji

Get to know the seller

Seller avatar
joeljohnsaji
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions