If I had my way, I would actually consider deprecating vstack/hstack In contrast, stack and concatenate are a betterįit for NumPy as a library for manipulating N-dimensional arrays. The way that vstack/hstack/dstack handle arrays ofĭifferent dimensionality is quirky and difficult to predict for most people Stack, because these routines are less general and powerful than stackĪnd concatenate. I actually intentionally omitted vstack and hstack from the docstring for It's worth taking a look at the discussion in my original PR for the full Numpy.stack is actually pretty new - it only was released in NumPy 1.10. You should really prefer concatenate or stack (keeping in mind it was addedĭon't forget row_stack and column_stack in this discussion either. saying "this function continues to be supported for backcompat, but Or subclassing.) I'd be +1 to putting a prominent note at the top of hstackĮtc. ![]() (Other examples that come to mind: no warnings against matrix We should definitely do a better job of conveying actual usage guidelines If you can figure out a way to do that, I would be very grateful for it. That said, none of this is explicitly stated in the docs right now. The *stack functions are mostly just noise. ![]() stack and concatenate (coupled with numpy's axis manipulation routines) are enough for nearly every use case. Of course, we can't really do that because of numpy's very strong backwards compatibility guarantees, but I would like to nudge users away from using these functions. ![]() If I had my way, I would actually consider deprecating vstack/ hstack instead. In contrast, stack and concatenate are a better fit for NumPy as a library for manipulating N-dimensional arrays. The way that vstack/ hstack/ dstack handle arrays of different dimensionality is quirky and difficult to predict for most people without experimentation. I actually intentionally omitted vstack and hstack from the docstring for stack, because these routines are less general and powerful than stack and concatenate. It's worth taking a look at the discussion in my original PR for the full context: #5605.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |