I need to create a list in Python from a minimum and a maximum value. Half of the list needs to go up, and the other half needs to go down. Here's what I'm doing for now:
random_data = np.random.uniform(min_value, max_value, 6))
up_data = np.sort(random_data)
down_data = -np.sort(-random_data)
df = np.concatenate((up_data, down_data))
- I create a list of 6 random numbers between a minimum and a maximum.
- I sort them from down to up in a list.
- I sort them from up to down in another list.
- I put the two lists together.
It's working, but I don't like how it looks. I'm sure there must be a better way to do this but I just can't find anything. Thank you for your help!