Use numpy
>>> import numpy
>>> x = range(25)
>>> l = numpy.array_split(numpy.array(x),6)
or
>>> import numpy
>>> x = numpy.arange(25)
>>> l = numpy.array_split(x,6);
You can also use numpy.split but that one throws in error if the length is not exactly divisible.
More Related Contents:
- how to parse the response in python?
- How to print a date in a regular format?
- In pandas, is inplace = True considered harmful, or not?
- How do I convert a pandas Series or index to a Numpy array? [duplicate]
- (-5:Bad argument) in function ‘rectangle’ – Can’t parse ‘pt1’. Sequence item with index 0 has a wrong type
- Unable to use Selenium to automate Chase site login
- Django Rest Framework File Upload
- “ImportError: No module named” when trying to run Python script
- Update row values where certain condition is met in pandas
- Pipe character in Python
- How do I insert a JPEG image into a python Tkinter window?
- Python, Pandas : write content of DataFrame into text File
- matplotlib.pyplot will not forget previous plots – how can I flush/refresh?
- Why python mock patch doesn’t work?
- Lifetime of object in lambda connected to pyqtSignal
- How to connect to a remote Windows machine to execute commands using python?
- Numpy: efficient way to generate combinations from given ranges
- ‘str’ object has no attribute ‘decode’ in Python3
- Unbalanced data and weighted cross entropy
- Python: slicing a multi-dimensional array
- return max value from pandas dataframe as a whole, not based on column or rows
- How to run ” ps cax | grep something ” in Python?
- Remove NaN/NULL columns in a Pandas dataframe?
- how to turn on minor ticks only on y axis matplotlib
- Python and SQLite: insert into table
- How to log Keras loss output to a file
- Iterating through a string word by word
- What is right batch normalization function in Tensorflow?
- What does it mean to “consume” in Python? In an iterator?
- Pandas: Create missing combination rows with zero values