我有一组值:-
1.2
1.0
2.6
2.4
2.8
5.1
2.5
5.4
1.3
1.1
10.3
4.1
3.4
3.2
6.1
6.3
9.0
8.6
7.1
3.2
4.3
15.0
12.3
13.1
17.4
10.2
11.7
14.6
16.3
现在,我如何将它们分组,以便十进制值将转到最接近的整数值并给出它的出现次数。即,如果值为 1.2,则应为 1.0,如果值为 8.6,则应为 9(其最接近的整数)。
我希望输出为: -
0.0 - 1.0 its occurrence
1.1 - 2.0 its occurrence
2.1 - 3.0 its occurrence
3.1 - 4.0 its occurrence
4.1 - 5.0 its occurrence
16.1 - 17.0 its occurrence
因此我可以将垃圾箱作为 x 轴及其在 y 轴上的出现次数,从而绘制图表。我怎样才能为此编写一个python程序..??