0 ratings0% found this document useful (0 votes) 6 views4 pagesPython 0002
python practical class 12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
runfile(
Capt)
Cpe)
Cement)
Cry eee)
Clay CemeUess
Meee Ce Eyes ace ae HT
Tey aaa eae ED)
eS)
ce
ee)
ee)
Cs ees
Creek le
SPUN Ese
28
Ee
Er
31
Er
Es
31
ee
rarity Es
Tr aD
De ere
Coy ees
sel
cE
PrP)
a
pCa
re
ey eae)
eae
TEU!SAMPLE OUTPUT:
Name Age
stul Arun 21
stu2 Bala 23
Stu3 Charan 22
BAMELM UULEUL;
The details of Toys are:
ap 7916
oD 3508
MP 7226
UR 7617
Name: Toys, dtype: intés
The details of AP and op are
Toys Books Uniform shoes
AP 7916 61896 610 e810
op @508 8208 508 6798
The details of mp and U.P are:
Books Uniform
MB 6149 511
U.P 6157 457
Consecutive 3 Rows and 3 columns are:
Toys Bocks Uniform
AP 7916 51896 610
op 8508 8208 508
MP 7226 6149 611.
SAMPLE OUTPUT:
After Adding a new column:
Toys Books Uniform Shoes
AP 7916 61896 610 8810
op 8508 +8208 508 6798
M.P 7226 ©6149 611 9611
U.P 7617 6157 457 6457
After Deleting M.P details:
Toys Books Uniform Shoes
AP 7916 61896 610 8910
op «68508 = 8208 508 6798
U.P 7617 6157 457° 6457
Bags
5891
8628
9785
4475
Bags
5891
8628
4475Sample Output:
Original DataFrame
‘AP Assam Sikkim TN AIMS
Gc 17 60 MN 22 7.0
PC 90 NaN 1.0 26 NaN
TS T1S0 726.0 100.0 46 673.0
Fevs 26000 3300.0 27000.0 23000 15000.0
(Changing the name from AP to Andhra:
‘Andhra Assam Sikkim TN AUMS
ac 17 60 MN 22 7.0
PC 30 MaN 1.0 24 NaN
TS 7180 728.0 100.0 46 673.0
Fees 25000 3900.0 27000.0 23000 15000.0
‘Counting and displaying non-NaN values of exch column:
Andie 4
‘Assam 3
Sikkim 3.
™ 4
alms 3
type: int
Counting and displaying non-NaN values of each row:
cc 4
Fo 3
5
Fees 5
type: intea
Increasing the fess of all colleges by 5%
Andhra Assam Sikicim TN AIMS
Gc 17.0 6.0 NaN 220 7.0
PC 30.0 NaN 1.0 24.0 NaN
TS 7150.0 726.0 100.0 46.0 673.0
Fees 26250.0 34650.0 28350.0 24150.0 15750.0
Replacing all NaN values with 0:
Andhra Assam Sikkim TH AIMS
GC 17.0 60 0.0 220 7.0
PC 30.0 0.0 1.0 24.0 0.0
TS 7150.0 726.0 100.0 46.0 673.0
Fees 26250.0 34650.0 28350.0 24150.0 15750.0SAMPLE OUTPUT:
Stu_Name Degree Percentage
sl Anu = MBA 90
83 Bala ME 91
SAMPLE OUTPUT:
Tndex of the DataFrame Ter
indexi[Stul, 'Stu2’, 'Stu3', ‘Stud, dtypes'object’)
rhe columns of the DataFrame is:
Iindead['Stu Name’, Degree’, Percent'], dtypew'object)
rhe axes of the DataFrame
ndex{[Stul’, 'Stu2’, 'Stus', ‘Stut], dtyper'object), Indexif'Stu Name’, ‘Degree’, Percent}, dtyper*object'
the data types of the DataFrame is:
Stu Name object