I have an array in Jupyter. I want to create two new arrays, one with the top 30% of values from the original array and one with the bottom 30% of values from the original array. Please help!
In Python you do it like this:
X = [1,2,3,4,5,6,7,8,9,10]
len_pct = int(len(X) * 0.3)
first, last = X[0:len_pct], X[len(X)-len_pct:len(X)]
print(first); # [1,2,3]
print(last); # [8,9,10]
Live demo here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.