The difference between flatten and ravel is that flatten will return a copy of the array whereas ravel will refence the original if possible. Thus, if you modify the array returned by ravel, it may also modify the entries in the original array.

It is usually safer to create a copy of the original array, although it will take more time since it has to allocate new memory to create it.

You can read more about the difference between these two options here.

Email codedump link for How to reshape numpy array of array into single row