我在做一个分位数的问题,我需要做这样的事情
间隔:

150-155
155-160
160-165
165-170
170-175
175-180
180-185

>> inferior_limit = 150
>> superior_limit = 185
>> range = inferior_limit - superior_limit
>> number_of_intervals = 5

这些就是变数
我需要这个因为我在做一个桌子的间隔
>> width = range/number_of_intervals
>> while inferior_limit <= superior_limit
# there is my problem
>> inferior_limit += width
>> print inferior_limit

最佳答案

这就是你的意思吗?

>>> inf, sup, delta = 150, 185, 5
>>> print '\n'.join('{}-{}'.format(x, x + delta) for x in xrange(inf, sup, delta))
150-155
155-160
160-165
165-170
170-175
175-180
180-185

关于python - 列出Python Quantile,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11661070/

10-10 07:21