[SciPy-User] [SciPy-user] Looping over one variable keeping the others constant

eat e.antero.tammi@gmail....
Sat Apr 14 00:09:45 CDT 2012


Hi,

On Fri, Apr 13, 2012 at 7:06 AM, surfcast23 <surfcast23@gmail.com> wrote:

>
> Hi All,
>
>  I would like to know how one can loop over one variable incrementing it
> while keeping the second fixed. With the final out put being a table of
> values. For example hold y fixed and increment x then increment y and
> re-increment  x so you would get something like this
>
> x,y
> 1,1
> 2,1
> 3,1
> 1,2
> 2,2
> 3,2
>

Perhaps something along the lines will help you:
In []: c_[tile(arange(3), 2), arange(2).repeat(3)]+ 1
Out[]:
array([[1, 1],
       [2, 1],
       [3, 1],
       [1, 2],
       [2, 2],
       [3, 2]])


My 2 cents,
-eat

>
> thanks in advance
> --
> View this message in context:
> http://old.nabble.com/Looping-over-one-variable-keeping-the-others-constant-tp33679664p33679664.html
> Sent from the Scipy-User mailing list archive at Nabble.com.
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120414/2bd1beec/attachment.html 


More information about the SciPy-User mailing list