0% found this document useful (0 votes)
10 views24 pages

Ayush IP

Uploaded by

yashue19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views24 pages

Ayush IP

Uploaded by

yashue19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

1

Ayush
ishu rathi 12b Rathi 12C

PANDAS-SERIES
1) Create a series from a python sequence (list) with customized index.

OUTPUT:

2) Create a series from an ndarray (using arrange () function) with


customized index.

OUTPUT:

TANISHQ SINGH LAMBA


2
ishu rathi 12b Ayush Rathi 12C
3) Create a series from an ndarray (using array() function) with
customized index.

OUTPUT:

4) Create Series from a dictionary with customized index.

'ishu rathi'

ishu rathi
OUTPUT:

5) Create a series from a scalar value with customized index.

OUTPUT:
3
ishu rathi 12b Ayush Rathi 12C
6) Create a series using dictionary and use all the attributes of Series
Object.

ishu rathi

OUTPUT:
ishu rathi

ishu rathi

TANISHQ SINGH LAMBA


4
ishu rathi 12b Ayush Rathi 12C
7) Create a series with the name S1and perform the following vector
operations: S1+2, S1*3, S2=S1**2, S1>15

LISTS1:

a) S1+2:- b)S1*3:-

c)S2=S1**2:- c)S1>15:-

8) Create two series as following


s1 s2 s3
0 1.85 a 1.50 0 2.75
1 12.75 b 12.75 1 12.50
2 -15.75 C 24.00 2 22.25
3 -15.75 d 35.25 3 32.00
4 46.50 e 46.50 4 41.75

And perform arithmetic operations as given below:

(i)s1*s3 (ii)s1/s3 (iii)s1+s2

TANISHQ SINGH LAMBA


ishu rathi 12b Ayush Rathi 12C
5

OUTPUT:

TANISHQ SINGH LAMBA


ishu rathi 12b 6
Ayush Rathi 12C

PANDAS-DATAFRAME
9) Create Data Frameusing-listoflists.with customized row·index and
columns.

OUTPUT:

10) Create Data Frame using dictionary of lists with customized


row index and columns.

OUTPUT:

TANISHQ SINGH LAMBA


7
ishu rathi 12b Ayush Rathi 12C
11) Create Data Frame using list of dictionaries with
customized row index and columns.

OUTPUT:

12) Create Data Frame using dictionary of series with customize


drow index.

OUTPUT:

13) Create Data Frame using dictionary of dictionaries


with customized row and columns index.

OUTPUT:

TANISH QSINGHLAMBA
8
ishu rathi 12b Ayush Rathi 12C
14) Create a Data Frame using any method and
use all the attributes of Data Frame objects.

OUTPUT:

TANISHQ SINGH LAMBA


9
ishu rathi 12b Ayush Rathi 12C

15) Create a Data Frame namely “result” that stores the


roll numbers, names and total marks of students as
follows:
ROLL NAME MARK
FlRST 1 Suresh 98
SECOND 2 Mahesh 96
THIIRD 3 Ramesh 94
FOURTH 4 Jites 91
Now write the, code to display the, subset data from the
Data Frame, as follows:

ROLL NAME
FlRST 1 Suresh
SECOND 2 Mahesh
THIRD 3 Ramesh

OUTPUT:

TANISHQ SINGH LAMBA


10
ishu rathi 12b Ayush Rathi 12C

16) Consider the following Data Frame sales Df:


target Sales
Zone A 56000 58000
Zone B 70000 68000
Zone C 75000 78000
Zone D 60000 61000
write a program to add a column namely “order” having
values 6000, 6700, 6200 and 6000 respectively for the
zones A,B,C and D.The program should also add a new
row for a new zone E. Add some dummy values in this
row. Now write the code to delete the last row from the
above Data Frame.

OUTPUT:

TANISHQ SINGH LAMBA


11
ishu rathi 12b
Ayush Rathi 12C

17) Write the code to create a Data Frame to store


Roll numbers names and total marks of students and Save it to a csv
file with the name-1abc.csv.Nowwrite the code to read this csv file
in a Data Frame.

OUTPUT:

TANISHQ SINGH LAMBA


12
ishu rathi 12b Ayush Rathi 12C

DATA
VISUALIZATION
18) Write code to plot aline chart to display following data:
overs 1 2 3 4 5
IND_runs 12 7 5 10 8
NZ_runs 10 6 4 9 5
As per following details:
a. Overs must be displayed on x-axjs with label as OVERS
b. Runs must be displayed ony-AXIS with label as Runs
c. Legend should display at right to pcorner.
d. Line color of INDIAN team inchart must be red.
e. Line color of Newzeland team in chart
must be blue

OUTPUT:

TANISHQ SINGH LAMBA


ishu rathi 12b 13
Ayush Rathi 12C
19) Write code to plot bar chart to show comparative analysis of runs
as per the data given in Q.no.18.
As per the following details:
a. Red color of bar to display runs of INDIA.
b. Blue color of bar to display runs of Newzeland
c. Legend must display at left top corner.
d. Overs must be displayed on x-axis with label as OVERS'
1

e. Runs must be displayed ony-axis with label as Runs


f. Save chart with the name run.png

OUTPUT:

MBA
14
ishu rathi 12b Ayush Rathi 12C
20) A survey gathers height and weight of 50 participants and recorded
the participants ages as:
ages=[1,2,3,5,7,8,5,6,8,9,12,23,43,56,2,3,54,67,89,12,13,14,23,14,145,
23,34,45,56,87,90,67,50,1,23,34,62,28,56,12,15,18,21,24,27,28,28,29,2
0,90]
Write a program to plot a histogram from above data with 20 bins.

OUTPUT:

TANISHQ SINGH LAMBA


15
ishu rathi 12b
Ayush Rathi 12C

MySQL
21) Create a database 'School' on the data base server, show the list
of data bases and open it.

22) Create the following table named 'STUDENT' with appropriate


data type, size and constraint(s)if any.

FIELDNAME DATATYPE SIZE CONSTRAINTS


ROLL INTEGER 12 PRIMARYKEY
NAME CHAR 20
DOB DATE
GENDER CHAR 10
CITY VARCHAR 20
MARKS FLOAT 10

TANISHQ SINGH LAMBA


ishu rathi 12b 16
Ayush Rathi 12C

23) Insert the following details in the table:


ROLE NAME DOB GENDER CITY MARKS
101 RYANSHARMA 2002-12-11 M MEERUT 450.87
102 SHIKSHA 2001-11-01 F DELHI 670.95
103 MOHITA 2002-08-05 F MUMBAI 890.45
104 RYAN VERMA 2000-04-21 M MEERUT 540.63
105 ISHAN 1999-11-09 M LUCKNOW 688.36
106 MITALI 1999-12-21 F DELHI 999.78
107 ADARSH 2000-10-10 M MUMBAI 887.55

TANISHQ SINGH LAMBA


17
ishu rathi 12b
Ayush Rathi 12C

24) Display all the information of males whose city is NEITHER Delhi
nor Mumbai.

25) Display the details of all students whose dateof birth lies before year
2002 and after year 1999.

26) Display all the information in alphabetically decreasing order of


their names.

TANISHQ SINGH LAMBA


18
ishu rathi 12b Ayush Rathi 12C
27) Display all columns arranged in descending order of city and within
the city in the ascending order their marks.

28) List names of all students whose name has the character‘a’.

29) Display Name and Marks of those students whose marks is in the
range 400 and800( bothare inclusive)

TANISHQ SINGH LAMBA


19
ishu rathi 12b Ayush Rathi 12C
30) Display city-name and total number of students from that city.

31) Display city-name and sum of marks of the students from each city.

32) Display average marks, highest marks and total no. of students for
each city.

TANISHQ SINGH LAMBA


20
ishu rathi 12b
Ayush Rathi 12C
33) Display total no of males and females separately, along with
their average marks.

34) Increase the marks by 5% of the students who belongs to meerut.

35) Add one more column to the table with the name “contact
number” (data type–varcharand size12).

36) Remove existing primary key from the table.

37) Add primary key constraint to the column“NAME”.

TANISHQ SINGH LAMBA


21
ishu rathi 12b Ayush Rathi 12C
38) Display roll, name and marks of those students who belongs to
meerut or delhi or lucknow.

39) Display name, data of birth and day name (like Sunday,
Monday,.),of those students whose marks is greater than or equal to
500.

TANISHQ SINGH LAMBA


22
ishu rathi 12b Ayush Rathi 12C
40) Display City and highest marks of students of each city, but only
for Delhi and Mumbai.

41) Display the names of students and marks after rounding off the
marks up to 1 place.

TANISHQ SINGH LAMBA


23
ishu rathi 12b Ayush Rathi 12C
42) Write a query to display name and the position of character 'a' in
the names of students having “R” anywhere in their names.

43) Display name, 3rd and 4th character of each name and counting
of number of characters in each name.

44) Display current date and time of today.

TANISHQ SINGH LAMBA


24
ishu rathi 12b Ayush Rathi 12C
45) Display name, marks and round up the square root of marks up to
2 decimal places.

TANISHQ SINGH LAMBA

You might also like