UNIT II :Mathematical Computing and Data Manipulation with Python: NumPy and Pandas Essentials

5
(1)

Sample question from UNIT I, Unit II and Unit III

UNIT II

Mathematical Computing with Python (NumPy)

  1. What are NumPy arrays, and how do they differ from Python lists? Provide an example of creating a NumPy array.
  2. 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?
  3. 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.
  4. How would you index and slice a NumPy array? Provide an example of accessing a specific element and slicing a portion of an array.
  5. What are some common numerical operations that can be performed on NumPy arrays? Demonstrate how to perform element-wise addition, subtraction, multiplication, and division.
  6. 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(), and np.max().
  7. How can NumPy be used for data processing? Provide an example of filtering elements from a NumPy array based on a condition.
  8. 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?
  9. How does NumPy generate random numbers? Provide an example of generating random numbers using NumPy’s random module.

Data Manipulation with Pandas

  1. What is data wrangling in the context of Pandas? Explain how you would clean and transform raw data into a usable format for analysis.
  2. 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.
  3. What is the process for cleaning data in Pandas? How would you handle missing values in a dataset using Pandas methods like dropna() and fillna()?
  4. 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.
  5. How can you merge multiple datasets in Pandas? Explain the difference between the merge() function and concat(), and when each should be used.
  6. Describe the process of reshaping data in Pandas. How would you reshape data using the pivot() or melt() functions, and why is reshaping important in data analysis?
  7. How do you aggregate data in Pandas? Provide an example of calculating the sum, mean, or count of values grouped by a specific column.
  8. 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.
  9. 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?

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Be the first to comment

Leave a Reply

Your email address will not be published.


*