Question bank

Filter questions by subject, topic and difficulty. Open any question to answer it and see the explanation.

Clear
255 questions found · practise this subject as a set Show 20 · 50 per page
#QuestionSubject and topicDifficulty
201 Which accessor selects rows and columns by their position numbers? Computer Science/Informatics Practices
Indexing, merging and CSV
Easy
202 Which method writes a DataFrame df to a file named result.csv? Computer Science/Informatics Practices
Indexing, merging and CSV
Easy
203 A DataFrame has index r1 to r4 and Marks 78, 45, 91 and 62. How many rows does df[df['Marks'] > 60] return? Computer Science/Informatics Practices
Indexing, merging and CSV
Medium
204 For the same DataFrame with index r1, r2, r3, r4, which two expressions both return the rows r2 and r3? Computer Science/Informatics Practices
Indexing, merging and CSV
Medium
205 d1 has id values 1, 2, 3 and d2 has id values 2, 3, 4, each with one other column. How many rows does pd.merg… Computer Science/Informatics Practices
Indexing, merging and CSV
Hard
206 Which function returns the number of non-missing values in each column of a DataFrame? Computer Science/Informatics Practices
Descriptive statistics
Easy
207 Which Pandas method gives count, mean, standard deviation, minimum, quartiles and maximum together? Computer Science/Informatics Practices
Descriptive statistics
Easy
208 For s = pd.Series([2, 4, 4, 4, 5, 5, 7, 9]), what is s.median()? Computer Science/Informatics Practices
Descriptive statistics
Medium
209 For u = pd.Series([10, np.nan, 30, 40]), what does u.mean() return? Computer Science/Informatics Practices
Descriptive statistics
Medium
210 df = pd.DataFrame({'P': [3, 1], 'Q': [4, 2]}). What does df.max(axis=1) return? Computer Science/Informatics Practices
Descriptive statistics
Hard
211 Which method arranges the rows of a DataFrame in order of the values of a column? Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Easy
212 In df.groupby('Dept')['Sal'].sum(), what does groupby('Dept') do? Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Easy
213 Dept values are HR, IT, HR, IT, Sales with salaries 30, 50, 40, 60, 20. What does df.groupby('Dept')['Sal'].s… Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Medium
214 s = pd.Series([1, 2, 3], index=['a', 'b', 'c']). What does s.reindex(['c', 'a', 'z']) contain? Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Medium
215 A sales table has columns Year, Item and Qty, and the pair (2020, Pen) appears twice. Which method can reshap… Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Hard
216 What does NaN represent in a Pandas DataFrame? Computer Science/Informatics Practices
Missing values and MySQL
Easy
217 Which method replaces all missing values in df with 0? Computer Science/Informatics Practices
Missing values and MySQL
Easy
218 df has columns A = [1, NaN, 3] and B = [NaN, NaN, 6]. What is the shape of df.dropna()? Computer Science/Informatics Practices
Missing values and MySQL
Medium
219 For the same df, what is the shape of df.dropna(how='all')? Computer Science/Informatics Practices
Missing values and MySQL
Medium
220 A student wants to add the rows of a DataFrame df to an existing MySQL table result without deleting old rows… Computer Science/Informatics Practices
Missing values and MySQL
Hard