Sample question from UNIT I, Unit II and Unit III
UNIT II
Mathematical Computing with Python (NumPy)
- What are NumPy arrays, and how do they differ from Python lists? Provide an example of creating a NumPy array.
- Explain the concept of data types in NumPy. How can NumPy handle different types of data, and what is the advantage of using NumPy arrays over standard Python lists?
- Describe different ways of creating NumPy arrays. Give an example of how to create an array using a range of numbers and another example using random numbers.
- How would you index and slice a NumPy array? Provide an example of accessing a specific element and slicing a portion of an array.
- What are some common numerical operations that can be performed on NumPy arrays? Demonstrate how to perform element-wise addition, subtraction, multiplication, and division.
- What are some useful array functions in NumPy, and how can they be applied to manipulate and process data? For example, explain the use of
np.sum()
,np.mean()
, andnp.max()
. - How can NumPy be used for data processing? Provide an example of filtering elements from a NumPy array based on a condition.
- Explain how to load and save data using NumPy. What functions would you use to save an array to a file and then load it back into Python?
- How does NumPy generate random numbers? Provide an example of generating random numbers using NumPy’s
random
module.
Data Manipulation with Pandas
- What is data wrangling in the context of Pandas? Explain how you would clean and transform raw data into a usable format for analysis.
- How can you explore and summarize data using Pandas? Describe the methods for displaying the first few rows of a DataFrame and generating basic descriptive statistics.
- What is the process for cleaning data in Pandas? How would you handle missing values in a dataset using Pandas methods like
dropna()
andfillna()
? - Explain how you would filter data in Pandas based on certain conditions. Provide an example of selecting rows where a specific column meets a condition.
- How can you merge multiple datasets in Pandas? Explain the difference between the
merge()
function andconcat()
, and when each should be used. - Describe the process of reshaping data in Pandas. How would you reshape data using the
pivot()
ormelt()
functions, and why is reshaping important in data analysis? - How do you aggregate data in Pandas? Provide an example of calculating the sum, mean, or count of values grouped by a specific column.
- How can you read and write data files in Pandas? Explain how you would load data from a CSV file and save a modified DataFrame back to a new CSV file.
- What are the advantages of using Pandas for data manipulation? How does it simplify common tasks like filtering, aggregation, and reshaping compared to standard Python data structures?
Leave a Reply