Numpy methods #22
Replies: 3 comments
|
Flatten() is a method used in numpy library. It is used in arrays concept, its function is to convert 2D or 3D arrays into 1D array, |
0 replies
Answer selected by
mssanamateen
|
flatten is used to take a list of lists or arrayand turn it into a single list or array |
0 replies
|
flatten() simplifies multi-dimensional arrays into a single line of data, making it easier to work with. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flatten() is a method used in numpy library. It is used in arrays concept, its function is to convert 2D or 3D arrays into 1D array,
For example lets say, there is an array arr1=[[1,2],[3,4]] which is a 2D array when we use flatten() function, it converts arr1 into a 1D array which will give an output as arr_flattened=[1,2,3,4]