x = e[['a','b','c','d']]
step = 110
x_pieces = [x[i:i+step] for i in range(0, len(x), step)]
So, I have a data frame e and a, b ,c , d are corresponding columns in data frame.
Here, I am diving the data in steps of 110. But, I would like to specify the step size as a range and in float. Could anyone please help?
syntax is range(start, end, step). Example: range(0,100,10).
Here's the output as a list, using list(range(0,100,10))
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
If you want it to reach 100, with stepsize=10, then add that to your range end, list(range(0,110,10)) gives
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With