Questions

3 Marks Each

🎯

Test yourself on this topic

8 questions · timed · auto-graded

Question 13 Marks
Explain the concept indexing operator [] :
Answer
Indexing operator is used to refer to the square brackets following an object. The .loc and .iloc indexers also use the indexing operator to make selections. In this indexing operator to refer to df[].
View full question & answer
Question 23 Marks
How to iterate over a Pandas DataFrame? Explain any one with help of an example.
Answer
You can iterate over the rows of the DataFrame by using for loop in combination with an iterrows() and iterritems() call on the DataFrame.

View full question & answer
Question 33 Marks
Write a program using pandas to do the following task

(a) To create the, Data Frame with columns Name, Occupation, Date of join, Age. The datafrme should contain only 2 rows.

(b) Add the index Emp001 and Emp002.

(c) Print the data

(d) Add a new row [Emp003]

Answer
"' A python script to input the values of Principal, Rate, and Time and calculate SI and CI."'

View full question & answer
Question 43 Marks
 Explain Reindexing in pandas.
Answer
Reindexing is used to confirm DataFrame to a new index with optional filling logic. It places NA/NaN in that location where the values are not present in the previous index. It returns a new object unless the new index is produced as equivalent to the current one, and the value of copy becomes False. It is used to change the index of the rows and columns of the DataFrame.
View full question & answer
Question 53 Marks
How will you add a column to a pandas DataFrame?
Answer
We can add any new column to an existing DataFrame. The below code demonstrates how to add any new column to an existing DataFrame:

View full question & answer
Question 63 Marks
How will you create an empty DataFrame in Pandas?
Answer
Create an empty DataFrame:

The below code shows how to create an empty DataFrame in Pandas:

# importing the pandas library

import pandas as pd

info = pd.DataFrame()

print (info)

Output:

Empty DataFrame

Columns: []

Index: []

View full question & answer
Question 73 Marks
What are the significant features of the pandas Library?
Answer
The key features of the panda's library are as follows:

• Memory Efficient

• Data Alignment

• Reshaping

• Merge and join

• Time Series

View full question & answer
Question 83 Marks
Define DataFrame in Pandas?
Answer
A DataFrame is a widely used data structure of pandas and works with a two-dimensional array with labeled axes (rows and columns). DataFrame is defined as a standard way to store data and has two different indexes, i.e., row index and column index.

It consists of the following properties:

• The columns can be heterogeneous types like int and bool.

• It is a dictionary of Series structure where both the rows and columns are indexed. It is denoted as "columns" in the case of columns and "index" in case of rows.

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