Python Libraries - NumPy, Pandas, Matplotlib, SciPy - One Line Questions

1. What does `df.apply()` in Pandas do? Applies a function along an axis of the DataFrame
2. Which NumPy attribute returns the dimensions of an array? array.shape
3. Which Matplotlib object represents the entire figure, including all axes, titles, and legends? Figure
4. Which Pandas method is used to handle missing values (NaN)? All of the above
5. Which Pandas method is used to select rows based on a condition? All of the above
6. What is the default behavior of `df.drop()` if `axis` is not specified? Drops rows
7. What is the result of `np.dot(a, b)` when `a` and `b` are 1D NumPy arrays? Dot product of the two arrays
8. In SciPy, what does the `scipy.fftpack` module provide? All of the above
9. The `scipy.sparse` module is designed for: Handling matrices with a large proportion of zero elements
10. The `scipy.spatial` module contains functions for: Spatial data structures and algorithms (e.g., KDTree, distance calculations)
11. The `scipy.stats` module provides functions for what purpose? Statistical distributions and tests
12. What is the primary data structure in NumPy? ndarray
13. Which Pandas method is used to combine two or more Series or DataFrames along a particular axis? concat()
14. What is the fundamental difference between `np.array()` and `pd.Series()`? pd.Series() has an index associated with each element, while np.array() does not.
15. Which NumPy function creates an array with a specified data type? np.astype()
16. Which NumPy function generates an array with evenly spaced values within a given interval? np.linspace()
17. Which NumPy function is used to create an array of zeros? np.zeros()
18. Which NumPy function generates an array of random numbers from a uniform distribution? np.random.rand()
19. Which NumPy function creates an array by repeating elements of an existing array? np.tile()
20. Which NumPy function allows you to reshape an array without changing its data? np.reshape()
21. Which NumPy function returns the cumulative sum of elements along a given axis? np.cumsum()
22. What is the difference between `np.where(condition)` and `pd.Series.where(condition)`? np.where() returns indices where the condition is true, while Series.where() returns elements where the condition is true and NaN otherwise.
23. The `scipy.ndimage` module provides functions for: Image processing on n-dimensional arrays
24. What does the `axis=0` parameter typically represent in a Pandas DataFrame operation? Operations along rows
25. How do you create a Pandas Series from a Python list? pd.Series(list)
26. What does `scipy.integrate.quad()` do? Performs numerical integration of a function
27. To create a histogram in Matplotlib, which function is typically used? plt.hist()
28. Which Matplotlib function allows you to create subplots within a figure? plt.subplots()
29. Which Matplotlib function is used to add labels to the x and y axes? plt.xlabel() and plt.ylabel()
30. Which Matplotlib function adds a legend to a plot? plt.legend()
31. To create a pie chart in Matplotlib, you would use: plt.pie()
32. To create a scatter plot in Matplotlib, you would typically use: plt.scatter()
33. To create a bar chart in Matplotlib, you would typically use: plt.bar()
34. Which Matplotlib function is used to display a plot? plt.show()
35. Which Matplotlib function is commonly used to create a line plot? plt.plot()
36. Which Matplotlib function adds a title to a plot? plt.title()
37. What does `df.groupby()` in Pandas do? Splits data into groups based on some criteria, applies a function, and combines the results
38. What does the `inplace=True` argument in Pandas methods do? Modifies the DataFrame directly without returning a new one
39. In SciPy, which submodule is used for integration? scipy.integrate
40. Which SciPy submodule is used for signal processing tasks like filtering and spectral analysis? scipy.signal
41. What is the primary data structure in Pandas used for data manipulation and analysis? DataFrame
42. In SciPy, what is the primary use of the `scipy.optimize` submodule? Finding roots of functions and minimizing/maximizing functions
43. The `scipy.interpolate` module is used for: Fitting curves and surfaces to data points
44. The `scipy.linalg` module is primarily used for operations related to: Linear algebra
45. What is the result of `np.mean(array, axis=1)` for a 2D NumPy array? The mean of each row
46. What is the purpose of the `merge()` function in Pandas? To combine DataFrames based on common columns or indices, similar to SQL joins
47. What is the primary purpose of `np.linalg.solve(a, b)`? To solve the linear matrix equation `ax = b`
48. What is the primary function of the `pivot_table()` method in Pandas? To reshape data from a long format to a wide format, aggregating values
49. What is the purpose of the `read_csv()` function in Pandas? To read data from a CSV file into a DataFrame