| Class XII |
Informatics Practices |
Informatics Practices |
2 |
DataFrame Attribute Name Purpose Example DataFrame.index to display row >>> ForestAreaDF.index labels Index([‘GeoArea’, ‘VeryDense’, ‘ModeratelyDen... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
d ata between csV F ILes and d ata Frames We can create a DataFrame by importing data from CSV files where values are separated by commas. Similarl... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
RNo StudentName Sub1 Sub2 0 1 Arnab 18 57 1 2 Kritika 23 45 2 3 Divyam 51 37 3 4 Vivaan 40 60 4 5 Aaroosh 18 27 2.4.2 Exporting a DataFrame to a CS... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
does not support duplicate index values is attempted, an exception will be raised at that time. Think and Reflect A basic difference between Series... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
data values and the operations that can be applied to that data. It enables efficient storage, retrieval and modification to the data. • Two main d... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
row). • Data can be loaded in a DataFrame from a file on the disk by using Pandas read_csv function. • Data in a DataFrame can be written to a text... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
2 |
keys. d) MTseries, an empty Series. Check if it is an empty series. e) MonthDays, from a numpy array having the number of days in the 12 months of ... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
C h a p t e r Data Handling using Pandas - II “We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific disc... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
19 15 24 23 Zuhaire 1 20 17 22 24 19 Zuhaire 2 23 15 21 25 15 Zuhaire 3 22 18 19 23 13 Aashravy 1 23 19 20 15 22 Aashravy 2 24 22 24 17 21 Aashravy... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
to calculate the maximum values from the DataFrame, regardless of its data types. The following statement outputs the maximum value of each column ... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
unit test among all the subjects Reprint 2026-27 D atH anDling usPanDa- ii 67 >>> df.max(axis=1) n otes 0 22 1 24 2 24 3 24 4 25 5 23 6 23 7 24 8 2... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
18 Name == 'Mishti'].min() >>> print(dfMishti) S.St 20 Hindi 22 Eng 20 dtype: int64 Note: Since we did not want to output the min value of column U... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
mean. Activity 3.4 >>> df[['Maths','Science','S. Find the variance and St','Hindi','Eng']].var() standard deviation of the following scores on an e... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
with axis=0 gives the same result >>> df['Maths'].aggregate(['max','min'],axis=0) max 24 min 12 Name: Maths, dtype: int64 #Total marks of Maths and... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
1 Raman 2 21 20 17 22 24 2 Raman 3 14 19 15 24 23 3 Zuhaire 1 20 17 22 24 19 4 Zuhaire 2 23 15 21 25 15 5 Zuhaire 3 22 18 19 23 13 Now, to obtain s... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
Hindi values(by=['Science','Hindi'])) Name UT Maths Science S.St Hindi Eng 5 Zuhaire 3 22 18 19 23 13 11 Mishti 3 17 18 20 25 20 2 Raman 3 14 19 15... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
15 C 45 A 10 C 10 B 15 Sum C 15 C 20 C 20 Figure 3.1: A DataFrame with two columns The following statements show how to apply GROUP BY() function o... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
19 23 13 The above statements show how we create groups by splitting a DataFrame using GROUP BY(). Next step is to apply functions over the groups ... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
15 24 23 3 Zuhaire 1 20 17 22 24 19 4 Zuhaire 2 23 15 21 25 15 5 Zuhaire 3 22 18 19 23 13 6 Ashravy 1 23 19 20 15 22 7 Ashravy 2 24 22 24 17 21 8 A... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
below: >>> dfUT1.drop(columns=[‘index’],inplace=True) >>> print(dfUT1) Name UT Maths Science S.St Hindi Eng 0 Raman 1 22 21 18 20 21 1 Zuhaire 1 20... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
2017 and 2018. Example 3.1 >>> import pandas as pd >>> data={'Store':['S1','S4','S3','S1','S2','S3 ','S1','S2','S3'], 'Year':[2016,2016,2016,2017 ,... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
as index, year will be the headers for columns and sales value will be displayed as values of the pivot table. >>> print(pivot1) Year 2016 2017 201... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
Total_profit(Rs) Year 2016 2017 2018 2016 2017 2018 Store S1 12000.0 20000.0 30000.0 1100.0 32000.0 3000.0 S2 NaN 10000.0 11000.0 NaN 9000.0 1900.0... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
been used as the default aggregate function. Price of the blue pen in the original data is 50 and 20. Mean has been used as aggregate and the price... |
|
| Class XII |
Informatics Practices |
Informatics Practices |
3 |
have some missing attributes. There may be several reasons for that. In some cases, data was not collected properly resulting in missing data e.g s... |
|