Which of the following command will display a tuple representing the dimensionality of the DataFrame 'df'?
Which of the following command will display a tuple representing the dimensionality of the DataFrame 'df'?
Solution
✅ Correct Option: 3
df.shape returns a tuple giving the dimensions of the DataFrame. For example, a DataFrame with 5 rows and 3 columns gives (5, 3).
Option 1: df.values returns the data as a NumPy array, not the dimensions.
Option 2: df.size returns a single integer, the total number of elements (rows x columns), not a tuple.
Option 4: df.empty returns a Boolean (True or False) showing whether the DataFrame has no data.
Related questions:
2026: 11 May Shift 2
2026: 19 May Shift 1
2026: 13 May Shift 2