I am writing a program to show the age of 100 people whose ages range between 18 and 110. I want to set a negative value for a couple of them and an age bigger than 120 for other 3 people, then clean the dataset setting 0 in these 5 "wrong" ages, and then check the minimum and the maximum of the ages after the cleaning.
I have a solution by setting the wrong ages individually, but I would like to be able to do this by creating one array with 95 elements (the correct ages), another with 5 elements (the wrong ages), and then concatenate them. However I don´t know how to concatenate 1-D arrays that were generated differently.
Here is my existing solution:
peopleAge = np.random.randint(18,110,100)
peopleAge[12] = -6
peopleAge[15] = -23
peopleAge[29] = 132
peopleAge[80] = 155
peopleAge[99] = 200
peopleAge = np.where((peopleAge < 0) | (peopleAge > 120), 0, peopleAge)
minAge = min(peopleAge[peopleAge > 0])
maxAge = max(peopleAge[peopleAge < 111])
And here is what I am trying to do:
peopleAge = np.random.randint(18,110,95)
peopleAgeSpecial = np.array([-6,-23,132,155,200])
How can I join peopleAge and peopleAgeSpecial into one array?