我有一个数据框,如下所示
ID Price
1 5
2 90
3 20
4 40
5 30
6 70
7 60
8 100
9 80
10 50
从上面,我想将上面的数据框从10%过滤到90%,如下所示。
预期输出:
ID Price
2 90
3 20
4 40
5 30
6 70
7 60
9 80
10 50
between
+ Series.quantile
df[df['Price'].between(*df['Price'].quantile([0.1, 0.9]))]
ID Price
1 2 90
2 3 20
3 4 40
4 5 30
5 6 70
6 7 60
8 9 80
9 10 50