Well,

if

data=[[1, 2], [3, 4]]

then data[:,-2:] gives



Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_25.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding:
utf-8 -*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("ZGF0YVs6LC0yOl0="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmp4c8jhA/___code___.py", line 3, in <module>
    exec compile(u'data[:,-_sage_const_2 :]
  File "", line 1, in <module>

TypeError: list indices must be integers, not tuple


2012/7/23 Vegard Lima <[email protected]>

> Hi,
>
> On Mon, Jul 23, 2012 at 3:46 PM, Urs Hackstein
> <[email protected]> wrote:
> > maybe it is a silly question: Let "data" be a numpy array of floating
> point
> > numbers. Then data[:,-1] gives the last column. But how can one retrieve
> the
> > last two columns? I tried several attempts, but not succeeded.
>
> How about: data[:,-2:]
>
>
> Cheers,
> --
> Vegard Lima
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to