Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row class should support negative indexes and slice syntax #8

Open
GoogleCodeExporter opened this issue Oct 3, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

import arff
for row in arff.load('example.arff'):
    print row[-1]


Where this is the example file:
@relation diabetics_data
@attribute hair_color {blonde, black, blue}
@attribute age real
@attribute patno integer
@data
blonde, 17.2, 1
blue, 27.2, 2
blue, 18.2, 3







What is the expected output? What do you see instead?

Should print:

1
2
3

But this is happening:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    y = row[-1]
  File "/usr/local/lib/python2.7/dist-packages/arff/__init__.py", line 105, in __getitem__
    return self._data[key]
KeyError: -1

What version of the product are you using? On what operating system?

arff librry version 0.9
python 2.7
ubuntu 12.04

Original issue reported on code.google.com by [email protected] on 20 Sep 2012 at 5:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant