How to create an empty and a full NumPy array?
Sometimes there is a need to create an empty and full array simultaneously for a particular question. In this situation, we have two functions named as numpy.empty() and numpy.full() to create an empty and full arrays.
numpy.full(shape, fill_value, dtype = None, order = ‘C’) numpy.empty(shape, dtype = float, order = ‘C’)
In the above example, we create an empty array of 3X4 and full array of 3X3 of INTEGER type.
In the above example, we create an empty array of 4X2 and full array of 4X3 of INTEGER and FLOAT type.
In the above example, we create an empty array of 3X3 and full array of 5X3 of FLOAT type.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course