PythonTutorials.net
Toggle Menu
Home
Online Python Compiler
Tutorials
Django
Flask
Scikit-Learn
NumPy
NLTK
Pillow
Blog
All Posts
Data Analysis with NumPy and Pandas
Test your combined skills in data manipulation and numerical computation.
1. What is the primary data structure in Pandas used for tabular data?
Series
DataFrame
Array
List
2. Which NumPy function creates an array filled with zeros?
np.zeros()
np.ones()
np.arange()
np.empty()
3. Which of the following are core data structures in Pandas?
Series
DataFrame
Panel
Tensor
4. A Pandas DataFrame is a 2-dimensional labeled data structure with columns that can have different data types.
True
False
5. What is the NumPy function used to reshape an array into a specified shape? (function name only)
6. How can you access the 'age' column in a Pandas DataFrame named 'df'?
df['age']
df.age
Both A and B
Neither A nor B
7. Which NumPy functions compute statistical measures of an array?
np.mean()
np.sort()
np.median()
np.sum()
8. The NumPy operation arr1 * arr2 performs matrix multiplication when arr1 and arr2 are 2D arrays.
True
False
9. What Pandas method generates descriptive statistics (count, mean, std, etc.) for a DataFrame?
10. What does the Pandas method df.dropna() do by default?
Removes rows containing missing values (NaNs)
Removes columns containing missing values (NaNs)
Replaces NaNs with the mean of the column
Throws an error if NaNs are present
11. Which of the following are valid ways to create a Pandas DataFrame?
From a dictionary of lists
From a list of dictionaries
From a NumPy array
From a CSV file using pd.read_csv()
12. A Pandas Series can contain elements of different data types.
True
False
13. What is the output of np.array([1, 2, 3]) + np.array([4, 5, 6])? (as a space-separated string of numbers)
14. In NumPy, what does arr[1:4] return from the array arr = np.array([0, 1, 2, 3, 4, 5])?
[1, 2, 3]
[1, 2, 3, 4]
[0, 1, 2, 3]
[2, 3, 4]
15. Which Pandas methods are used to handle missing values?
dropna()
fillna()
interpolate()
groupby()
16. The Pandas groupby() method splits data into groups based on a key and applies a function to each group.
True
False
17. What is the Pandas function to read data from an Excel file? (function name only, excluding parentheses)
18. By default, what axis does the Pandas method df.mean() operate on?
Rows (axis=0)
Columns (axis=1)
Both rows and columns
No default axis
19. Which of these are attributes of a NumPy array?
.shape
.dtype
.size
.append()
20. NumPy arrays are mutable, meaning their elements can be modified after creation.
True
False
Reset
Answered 0 of 0 — 0 correct