Questions

2 Marks Each

🎯

Test yourself on this topic

9 questions · timed · auto-graded

Question 12 Marks
Define Values, columns and index related to pivoting.
Answer
Values: This argument allows you to specify which values of your original DataFrame you want to see in your pivot table.

Columns: Whatever you pass to this argument will become a column in your resulting table.

Index: whatever you pass to this argument will become an index in your resulting table.

View full question & answer
Question 22 Marks
Difference between pivot() and pivot_table().
Answer
Pivot(). In this function we cannot use any of the aggregate functions and this can only work with unique index value whereas pivot_table(). This function work with aggregate functions and non-unique value as well.
View full question & answer
Question 32 Marks
Describe Data Operations in Pandas.
Answer
In Pandas, there are different useful data operations for DataFrame, which are as follows:

Row and column selection

We can select any row and column of the DataFrame by passing the name of the rows and columns. When you select it from the DataFrame, it becomes onedimensional and considered as Series.

Filter Data

We can filter the data by providing some of the boolean expressions in DataFrame.

Null values

A Null value occurs when no data is provided to the items. The various columns may contain no values, which are usually represented as NaN.

View full question & answer
Question 42 Marks
How to Reset the index?
Answer
The Reset index of the DataFrame is used to reset the index by using the 'reset_index' command. If the DataFrame has a MultiIndex, this method can remove one or more levels.
View full question & answer
Question 52 Marks
How to Set the index?
Answer
We can set the index column while making a data frame. But sometimes, a data frame is made from two or more data frames, and then the index can be changed using this method.
View full question & answer
Question 62 Marks
Define ReIndexing.
Answer
Reindexing is used to change the index of the rows and columns of the DataFrame. We can reindex the single or multiple rows by using the reindex() method. Default values in the new index are assigned NaN if it is not present in the DataFrame.
View full question & answer
Question 72 Marks
What is Pandas Index?
Answer
Pandas Index is defined as a vital tool that selects rows and columns of data from a DataFrame. Its task is to organize the data and to provide fast accessing of data. It can also be called a Subset Selection. pd.Series(animals)
View full question & answer
Question 82 Marks
What is Data Aggregation?
Answer
The main task of Data Aggregation is to apply some aggregation to one or more columns. It uses the following:
sum: It is used to return the sum of the values for the requested axis.
min: It is used to return a minimum of the values for the requested axis.
max: It is used to return a maximum values for the requested axis.
View full question & answer
Question 92 Marks
How can we sort the DataFrame?
Answer
We can efficiently perform sorting in the DataFrame through different kinds:

• By label

• By Actual value

By label

The DataFrame can be sorted by using the sort_index() method. It can be done by passing the axis arguments and the order of sorting. The sorting is done on row labels in ascending order by default.

By Actual Value

It is another kind through which sorting can be performed in the DataFrame. Like index sorting, sort_values() is a method for sorting the values.

It also provides a feature in which we can specify the column name of the DataFrame with which values are to be sorted. It is done by passing the 'by' argument.

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