Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98869

Re: numpy column_stack - why does this work?

X-Received by 10.67.5.132 with SMTP id cm4mr30049880pad.19.1447660929810; Mon, 16 Nov 2015 00:02:09 -0800 (PST)
X-Received by 10.50.57.100 with SMTP id h4mr258392igq.6.1447660929777; Mon, 16 Nov 2015 00:02:09 -0800 (PST)
Path csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!i2no3478465igv.0!news-out.google.com!f6ni4003igq.0!nntp.google.com!i2no3478463igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 16 Nov 2015 00:02:09 -0800 (PST)
In-Reply-To <mailman.293.1447435057.16136.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=193.88.8.225; posting-account=LD5eswoAAACJ8r9iz31mMotQhYPaX-Yh
NNTP-Posting-Host 193.88.8.225
References <0b4725a8-a040-4bfb-b046-81c2e529447a@googlegroups.com> <mailman.293.1447435057.16136.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <96d95669-5cf5-4a33-ba51-878edd975e48@googlegroups.com> (permalink)
Subject Re: numpy column_stack - why does this work?
From PythonDude <mjoerg.phone@gmail.com>
Injection-Date Mon, 16 Nov 2015 08:02:09 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1953
X-Received-Body-CRC 120209266
Xref csiph.com comp.lang.python:98869

Show key headers only | View raw


On Friday, 13 November 2015 18:17:59 UTC+1, Ian  wrote:
> On Fri, Nov 13, 2015 at 8:37 AM, PythonDude <mjoexxxxx.com> wrote:
> > 3) I DON'T understand why the code doesn't look like this:
> >
> > means, stds = np.column_stack([
> >     for _ in xrange(n_portfolios):
> >       getMuSigma_from_PF(return_vec) ])
> 
> Because that would be invalid syntax; you can't put a for loop inside
> an expression like that. Your question is not about numpy.column_stack
> at all, but about list comprehensions. I suggest you start by reading
> this:
> 
> https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions
> 
> Then if you're still confused, come back and ask further questions.

Thank you very much, I'll look careful into that before asking again :-)

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

numpy column_stack - why does this work? PythonDude <mjoerg.phone@gmail.com> - 2015-11-13 07:37 -0800
  Re: numpy column_stack - why does this work? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-13 10:16 -0700
    Re: numpy column_stack - why does this work? PythonDude <mjoerg.phone@gmail.com> - 2015-11-16 00:02 -0800

csiph-web