Questions

4 Marks Each

🎯

Test yourself on this topic

4 questions · timed · auto-graded

Question 14 Marks

Answer the following question the basis of given dataframe:

Itemno ItemName Color Price
0 1 Ball Pen Black 15.0
1 2 Pencil Blue 5.5
2 3 Ball Pen Green 10.5
3 4 Gel Pen Green 11.0
4 5 Notenook Red 15.5
5 6 Ball Pen Green 11.5
6 7 Highlighter Blue 8.5
7 8 Gel Pen Red 12.5
8 9 P Marker Blue 5.6
9 10 Ball Pen Green 11.5

(i) To set the index to column Item Name.

(ii) To print the pivoting the data based on Item name as index, column as color and values as price.

(iii) To print the data as row index Itemname and columns index as color. Fill NaN as blank

(iv) To create another alias df3 and store the result of question 2.

(v) To add a new column QTY.

(vi) To print the mean priceod of all Item name and color wise.

(vii) To print the mean of the price, Item name and color margin wise.

(viii) To print the mean of the price, Item name and color wise with margins as Total.

(ix) To display the sorted data in ascending order according to the price

(x) To display the sorted data in descending order according to the price

(xi) To sort the data index wise.

(xii) To print the median.

(xiii) To print the maximum values column wise.

(xiv) To print the sum of the price.

(xv) To print the maximum of each column

(xvi) To print the first quantile of the price.

(xvii) To print the first quantile of Item no

(xviii) To print the first quartile, second quartile and third quartile. of Item no.

(xix) To print all the descriptive statistics.

View full question & answer
Question 24 Marks
Answer the questions with reference to below data frame:

class order max_speed
falcon bird Falconiformes 389.0
parrot bird Psittaciformes 24.0
lion mammal Carnivora 80.2
monkey mammal Primates NaN
leopard mammal Carnivora 58.0

(i) To print the class wise sum.

(ii) To print the order wise mean

(iii) To sort the index.

(iv) To print the sum of the class wise along with orders columns indexing.

(v) To count the records.

View full question & answer
Question 34 Marks
Based on the given dataset answer the questions given below:

From_To FlightNumber RecentDelays Airline
0 NewDelhi_Chennai 10045.0 [23, 47] Spicejet
1 Mumbai_NewDelhi NaN [] Indigo
2 Jaipur_Jammu 10065.0 [24, 43, 87] Spicejet
3 Chennai_Lucknow NaN [13] Indian Airlines
4 Mumnbai_Chennai 10085.0 [67, 32] Spicejet

(i) #To display the maximum flight number

(ii) #To print the number of flights airline wise

(iii) #to drop the nan values from the dataframe

(iv) To fill nan with blank values

(v) To print the maximum values of recent delays

(vi) To print the median of all the numeric values.

(vii) To print the sum of the recentdelays

(viii) To count the flight numbers.

(ix) To print the airline wise the sum of the recentdelays along with From_to as column

(x) To print the airline wise the sum of the recentdelays along with From_to as column. Also fill NaN values as blank.

View full question & answer
Question 44 Marks
Assuming the given dataset answer the questions given below:

animal age visits priority
a cat 2.5 1 yes
b cat 3.0 3 yes
c snake 0.5 2 No
d dog NaN 3 yes
e dog 5.0 2 No
f cat 2.0 3 No
g snake 4.5 1 No
h cat NaN 1 yes
i dog 7.0 2 No
j dog 3.0 1 No

(a) To create the dataframe from the above dictionary and index is stored in label list.

(b) To display the Data frame.

(c) To calculate the sum of all visits (the total number of visits).

(d) Calculate the mean age for each different animal in df

(e) To Append a new row 'k' to df with your choice of values for each column.

(f) To delete the new entered row.

(g) To count the number of each type of animal in df.

(h) To sort df first by the values in the 'age' in descending order, then by the value in the 'visit' column in ascending order.

(i) To print the maximum values of each column.

(j) To display all the statistics.

(k) To sort the data according the index.

View full question & answer
4 Marks Each - Computer Science STD 12 Commerce Questions - Vidyadip