Question bank

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

7,992 questions found Show 20 · 50 per page
#QuestionSubject and topicDifficulty
2681 Which statement adds a new column named City to an existing DataFrame df with three rows? Computer Science/Informatics Practices
DataFrames
Easy
2682 Which statement removes the column Grade from df and returns the result? Computer Science/Informatics Practices
DataFrames
Medium
2683 A DataFrame has 4 rows and 3 columns. What is the shape of its transpose df.T? Computer Science/Informatics Practices
DataFrames
Medium
2684 df has shape (3, 3). The statement df2 = df.drop('Grade', axis=1) is run. What are the shapes of df and df2? Computer Science/Informatics Practices
DataFrames
Hard
2685 Which accessor selects rows and columns by their position numbers? Computer Science/Informatics Practices
Indexing, merging and CSV
Easy
2686 Which method writes a DataFrame df to a file named result.csv? Computer Science/Informatics Practices
Indexing, merging and CSV
Easy
2687 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
2688 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
2689 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
2690 Which function returns the number of non-missing values in each column of a DataFrame? Computer Science/Informatics Practices
Descriptive statistics
Easy
2691 Which Pandas method gives count, mean, standard deviation, minimum, quartiles and maximum together? Computer Science/Informatics Practices
Descriptive statistics
Easy
2692 For s = pd.Series([2, 4, 4, 4, 5, 5, 7, 9]), what is s.median()? Computer Science/Informatics Practices
Descriptive statistics
Medium
2693 For u = pd.Series([10, np.nan, 30, 40]), what does u.mean() return? Computer Science/Informatics Practices
Descriptive statistics
Medium
2694 df = pd.DataFrame({'P': [3, 1], 'Q': [4, 2]}). What does df.max(axis=1) return? Computer Science/Informatics Practices
Descriptive statistics
Hard
2695 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
2696 In df.groupby('Dept')['Sal'].sum(), what does groupby('Dept') do? Computer Science/Informatics Practices
Aggregation, grouping and pivoting
Easy
2697 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
2698 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
2699 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
2700 What does NaN represent in a Pandas DataFrame? Computer Science/Informatics Practices
Missing values and MySQL
Easy