Q1:
2025: 30 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
State the output of the following code.
import pandas as pd
series1 = pd.Series(10,[11,22,33])
print(series1)
2025: 30 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
State the output of the following code.
import pandas as pd
series1 = pd.Series(10,[11,22,33])
print(series1)
2025: 30 May Shift 2
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Which of the following command is used to install Pandas from command line?
2025: 30 May Shift 2
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Identify the attributes of Pandas Series that assigns a name to the Series 'ser1'.
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
What will be the output of the following code?
import pandas as pd
data={'name': pd.Series(['Ashu','Arun','Ashi']),
'age':pd.Series([25,30,22]),
'gender':pd.Series(['M','M','F'])}
df = pd.DataFrame(data)
print(df.loc[0:1,['name','age']])
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Sometimes we need to extract a part of a series and for that we perform ______ operation.
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
How do you select rows from a DataFrame 'df', where the 'Amount' column is greater than 40000?
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
Consider a DataFrame 'df'. Which of the following statements are INCORRECT with respect to following operations?
(A) df['a'] = [30,40,50], will add a new column 'a' to the DataFrame 'df'.
(B) df.loc['a'] = [30,40,50], will add a new column 'a' to the DataFrame 'df'.
(C) df.['a'] = [30,40,50], will add a new row to the DataFrame 'df'.
(D) df.drop('a', axis =0) will delete the row with label 'a' from the DataFrame 'df'.
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
What is the correct syntax for extracting the last three rows of the DataFrame 'df'?
2025: 27 May Shift 2
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
You want to create a new DataFrame 'df3' by merging two DataFrames 'df1', 'df2' on the 'Roll_no' column, then which of the following is the correct syntax for this?
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Which parameter of the method to_csv() is used to exclude the row label to be written to the file on disk?
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
Which of the following are false about a DataFrame?
(A). It only allows homogeneous data.
(B). It does not allow missing values.
(C). It allows row and column indexing.
(D). It does not allow selection, deletion, addition, and renaming operations on rows and columns.
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
To transpose a DataFrame, the ______ is used.
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A). to_csv( ) | (I). Specifies the column labels. |
| (B). read_csv( ) | (II). Saves the file as .csv to a memory location. |
| (C). Header | (III). Reads the file from a memory location. |
| (D). Sep | (IV). Specifies the delimiter for values. |
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
What will be the result when two Pandas Series being combined have mismatched indices?
2025: 22 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A). loc[ ] | (I). Access using condition |
| (B). .iloc[ ] | (II). Access through labels |
| (C). Boolean indexing | (III). Access through position |
| (D). Slicing | (IV). Create a subset of the Array |
2025: 21 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
df = pd. Series(['London', 'Paris', 'NewDelhi', 'Moscow'], index = ['UK', 'France', 'India', 'Russia'])
Which of the following would reverse the order of the series?
2025: 21 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A). Head | (I). To display dimensionality of a DataFrame |
| (B). Tail | (II). To display the first 'n' elements of a DataFrame |
| (C). Shape | (III). To display the total number of elements in a DataFrame |
| (D). Size | (IV). To display the last 'n' elements of a DataFrame |
2025: 21 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
When positional indices are used for __________, the value at end index position is excluded.
2025: 21 May Shift 1
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
Consider the following table:
| Priya | Richa | Rohit | Soham | Riya | |
|---|---|---|---|---|---|
| Maths | 85 | 87 | 84 | 76 | 90 |
| Science | 86 | 76 | 86 | 66 | 92 |
| Hindi | 92 | 91 | 83 | 68 | 97 |
| English | 90 | 81 | 90 | 75 | 94 |
Which code represents the creation of a slice containing 'Priya' and 'Richa' marks in 'Maths' and 'Science' if the dataframe is represented using 'df' ?
(A). df.loc['Maths', 'Science', 'Priya' : 'Richa']
(B). df.loc['Maths' : 'Science', 'Priya', 'Richa']
(C). df.loc['Maths': 'Science', ['Priya', 'Richa']]
(D). df.loc[['Maths', 'Science'], ['Priya', 'Richa']]
2025: 21 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Consider the following table:
| Priya | Richa | Rohit | Soham | Riya | |
|---|---|---|---|---|---|
| Maths | 85 | 87 | 84 | 76 | 90 |
| Science | 86 | 76 | 86 | 66 | 92 |
| Hindi | 92 | 91 | 83 | 68 | 97 |
| English | 90 | 81 | 90 | 75 | 94 |
How to delete columns having the labels 'Rohit' and 'Soham' if the dataframe is represented using 'df' ?
2025: 20 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) rename() | (I) To display rows of a series from the top. |
| (B) tail() | (II) To change the name of a row or column in a DataFrame. |
| (C) drop() | (III) To display rows of a DataFrame from the bottom. |
| (D) head() | (IV) To delete a row or column in a DataFrame. |
2025: 20 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Arrange the following statements to create a series from a list.
(A) Define a list
(B) Import pandas library
(C) Display the series
(D) Create the series
2025: 20 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
A DataFrame can be created from:-
(A) Dictionary of lists
(B) List of dictionaries
(C) Numpy array
(D) Series
2025: 20 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
On the basis of the following series 'ser1', state the output of the command that follows:
ser1
| a | 100 |
|---|---|
| b | 900 |
| c | 700 |
| d | 200 |
| e | 500 |
print(ser1[ser1>700])
2025: 20 May Shift 1
Informatics Practices
Series & DataFrames
Hard
Informatics Practices
Which of the following are the correct commands to change the name of a row in a DataFrame 'df1'?
(A) df1.rename({old name:new name},axis='rows',inplace=True)
(B) df1.rename({old name:new name},axis=0,inplace=True)
(C) df1.rename({old name:new name},axis='index',inplace=True)
(D) df1=df1.rename({old name:new name},axis='rows',inplace=True)
2025: 16 May Shift 1
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
What will be the output of the loc[] pandas operation?
2025: 16 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Which of the following is a valid way to create a pandas series from a dictionary?
2025: 16 May Shift 1
Informatics Practices
Series & DataFrames
Medium
Informatics Practices
Which of the following are valid ways to create a pandas DataFrame?
(A) From the dictionary of the lists
(B) From a list of dictionaries
(C) From a NumPy array
(D) From a scalar value
2025: 16 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Arrange the following steps to access rows in a pandas DataFrame using Boolean indexing.
(A) Store or display the results
(B) Pass the condition as an index to the DataFrame
(C) Define or create a DataFrame
(D) Write condition to filter rows
2025: 16 May Shift 1
Informatics Practices
Series & DataFrames
Easy
Informatics Practices
Arrange the following steps to export Pandas DataFrame to a CSV file in correct sequence:
(A) Use the to_csv() function
(B) Create and define DataFrame
(C) Save the changes
(D) Provide the file name or path as an argument