Conversation
(I still think iterating over rows vs. over columns depending on input type is rather silly but at least this implementation makes it clearer.)
|
👍 Test failure looks unrelated. I also notice that |
|
It is implicitly tested by the various input shapes that tests pass to |
| if not hasattr(X[0], '__len__'): | ||
| X = [X] | ||
| # Iterate over columns for ndarrays, over rows otherwise. | ||
| X = X.T if isinstance(X, np.ndarray) else np.asarray(X) |
There was a problem hiding this comment.
Why would you behave differently for ndarrays than for any other 2D types? (such as matrices, 2D lists etc.)
There was a problem hiding this comment.
I feel very uncomfortable with having such a behavior in something that could be easily called in functions where we wouldn't want this behaviour. Is it possible to rename this function to something like _fundamentally_broken_reshape_2D and have a huge warning in the documentation?
There was a problem hiding this comment.
I would even go as far as raising a warning when a list is provided and deprecate the behavior we have with list.
There was a problem hiding this comment.
I agree with you, but I think these should be a separate issue. The only point of this PR is to deobfuscate the implementation of this function.
I think it is important to keep the ability to pass lists in -- it is natural to plot boxplots with unequal sized datasets, and you can't do that with a 2D array.
|
@tacaswell can we discuss about this PR tomorrow? |
(I still think iterating over rows vs. over columns depending on input
type is rather silly but at least this implementation makes it clearer.)
(Written while working on #8092, attn @phobson)