NumPy: Data Generation
✕Random Data Generation
Question 1 of 2
- Set the random seed to
42for reproducibility. - Generate a
3x3array of random integers between1and100. - Create a
4x4array of random samples from a standard normal distribution. - Generate a
5x5identity matrix. - Create
5x4array with values from normal distribution of mean50, std10. - Create a sequence of
10evenly spaced values between0and1. - Generate a
2x3array of random choices from the list[10, 20, 30].
- Set the random seed to
Mock Data Generation
Question 2 of 2
- Generate
csvfor student data with fields:RollNo,FirstName,LastName,Age,Height. - Use seed101for reproducibility. - Generate data for100students (using variabledata_size = 100). -RollNo: Unique integers sequentially from1todata_size. -FirstName,LastName: Randomly choose value from pre-defined lists. -Age: Random integers between18and25. -Height: From Normal distribution with mean160.0, std20.0cm. -Rating: Random floats between1.0and5.0. Hint: Generate each column separately using appropriate NumPy functions. Usezipto combine them. Usecsv.writerto save combined data into csv.
- Generate
