Differences between Flatten() and Ravel() Numpy FunctionsThere are two kinds of methods to convert a Ndarray into a 1D array flatten() as well as Ravel() The question here is, what is the reason there are two distinct roles to perform the same job? Differences between Flatten() and Ravel()P.ravel():
P.flatten():
Let's see the difference between flatter() and ravel() function using this code. Code: Output: Original array: [[3 4 5 6] [5 3 6 7]] Dimension of array: 2 The output for RAVEL [3 4 5 6 5 3 6 7] [1000 4 5 6 5 3 6 7] [[1000 4 5 6] [ 5 3 6 7]] Dimension of array 1 The output for FLATTEN [1000 4 5 6 5 3 6 7] [0 4 5 6 5 3 6 7] [[1000 4 5 6] [ 5 3 6 7]] Dimension of array 1
Next TopicLearning Vector Quantization
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week