Page 88 - Informatics_Practices_Fliipbook_Class12
P. 88
7. The read_csv() method in Pandas with the na_values option set to a specific value or a list of values
may be used to read missing values as NaN (Not a Number). _________
8. Grouping and aggregation in Pandas DataFrame can be performed using the groupby() function
along with aggregate functions like sum(), mean(), etc. _________
C. Fill in the blanks.
1. The _______________ function in Pandas DataFrame provides statistical summary metrics such as count, mean, standard
deviation, minimum, and quartiles.
2. The unique() method of Pandas DataFrame returns _______________ values found in a specified column.
3. To remove a column from a Pandas DataFrame, use the drop() method with the relevant column name and the axis
argument set to _______________.
4. To rename a column named "OldCol" to "NewCol" in a DataFramedf, we can use the syntax df = df. _____________
({'OldCol': 'NewCol'}, axis=1).
5. _______________ keyword argument should be set to all in describe() method to find summary statistics for
non-numeric columns.
6. Argument axis should be set to value _______________ to apply the operation row-wise across column.
7. Pandas allows us to set an attribute as an index using the method _______________.
8. Pandas method _______________ can be used to drop a column or row from the DataFrame.
9. In Pandas DataFrame, grouping and aggregation may be accomplished by using the _______________ method, followed by
an aggregate function such as sum(), mean(), or count().
10. To write the contents of a DataFramedf to a CSV file named 'details.csv', we can use the syntax df. _____________
('details.csv').
D. Answer the following questions:
1. Consider the following four series, each of them comprising the details of a student:
student1 = pd.Series(['Seema', 10, 'A', 99])
student2 = pd.Series(['Supriya', 11, 'B', 82])
student3 = pd.Series(['Mehak', 12, 'A', 95])
student4 = pd.Series(['Madhu', 13, 'B', 80])
Using the above four series, create a DataFrame with four columns namely, Name, RollNumber, Grade, and Marks.
2. Create a csv file with the following data and read the content in a Pandas DataFrame. Also, write statements to display the
number of rows, the number of columns, and column labels:
Gender;Age group;Population
Male;25-29;63129
Male;30-34;59247
Male;55-59;30768
Male;80-84;3944
Female;0-4;55340
Female;30-34;54832
Female;45-49;39938
Female;60-64;25038
Female;100+;23
Female;15-19;61074
Female;95-99;176
Male;75-79;7166
Male;95-99;119
Female;10-14;59621
Female;35-39;50436
Female;50-54;34835
Female;55-59;29953
74 Touchpad Informatics Practices-XII

