NumPy: Data Generation

  1. Random Data Generation

    Question 1 of 2

    • Set the random seed to 42 for reproducibility.
    • Generate a 3x3 array of random integers between 1 and 100.
    • Create a 4x4 array of random samples from a standard normal distribution.
    • Generate a 5x5 identity matrix.
    • Create 5x4 array with values from normal distribution of mean 50, std 10.
    • Create a sequence of 10 evenly spaced values between 0 and 1.
    • Generate a 2x3 array of random choices from the list [10, 20, 30].
  2. Mock Data Generation

    Question 2 of 2

    • Generate csv for student data with fields: RollNo, FirstName, LastName, Age, Height. - Use seed 101 for reproducibility. - Generate data for 100 students (using variable data_size = 100). - RollNo: Unique integers sequentially from 1 to data_size. - FirstName, LastName: Randomly choose value from pre-defined lists. - Age: Random integers between 18 and 25. - Height: From Normal distribution with mean 160.0, std 20.0 cm. - Rating: Random floats between 1.0 and 5.0. Hint: Generate each column separately using appropriate NumPy functions. Use zip to combine them. Use csv.writer to save combined data into csv.