These are chat archives for numpy/numpy

Jun 2017
Jun 18 2017 19:01
Hi. I’m new to numpy (coming from R and a bit of Julia) and have a dumb question. I’ve got Wes McKinney’s book and have searched numpy documentation and stack overflow but am still unclear. Why when you slice a 2d array wherein you drop a dimension, the shape is expressed as something like (5,) instead of just (5). I ask b/c if you slice a 3d array into 2d you get something like (5,6) and not (5,6,) which would to me be consistent with 2d->1d treatment.
Nick R. Papior
Jun 18 2017 19:19
That's because of tuples in python. To indicate that the shape is a tuple an additional "," is added IFF the array is 1d. So nothing to worry about here.
Jun 18 2017 19:28
got it. that’s great. 1d is just a special case b/c of tuples. Thanks @zerothi