We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
One thing I don't quiet understand. We can write nparray.flatten() and nparray.transpose(), but we can only use numpy.transpose(nparray) but not numpy.flatten(nparray), which gave an error message as 'module' object has no attribute 'flatten'.
Why?
is transpose and flatten a method? the explanation in the "problem description" indicated them as a tool? what's the difference?
I often confused by the usage here. when should we put the instance/object within the parenthesis and when to put them before the dot.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Transpose and Flatten
You are viewing a single comment's thread. Return to all comments →
One thing I don't quiet understand. We can write nparray.flatten() and nparray.transpose(), but we can only use numpy.transpose(nparray) but not numpy.flatten(nparray), which gave an error message as 'module' object has no attribute 'flatten'. Why? is transpose and flatten a method? the explanation in the "problem description" indicated them as a tool? what's the difference? I often confused by the usage here. when should we put the instance/object within the parenthesis and when to put them before the dot.