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

Valuecounter FIeldSelectionError when field selector is a tuple #641

Open
zuzanna-maria opened this issue Dec 9, 2022 · 3 comments
Open
Labels
Bug It must work in all situations, but this failed Can't Reproduce Needs more information to reproduce or locate the problem

Comments

@zuzanna-maria
Copy link

Like it says in the title - trying to reproduce the example use for ValueCounter given in docs, works fine if field is given as single name/index, throws 'Unprintable FieldSelectionError' when trying to provide field argument as tuple.

@juarezr juarezr added Bug It must work in all situations, but this failed Help Wanted We are volunteers. We'll be happy if you join us. labels Dec 9, 2022
@juarezr
Copy link
Member

juarezr commented Dec 9, 2022

Do you have a simple code snippet to speed up reproducing the bug and also for adding an automated test case for avoiding further regression?

@zuzanna-maria
Copy link
Author

The code snippet I used is the one provided in the documentation.

@juarezr
Copy link
Member

juarezr commented Dec 10, 2022

Not sure where the problem is exactly.
I noticed that field is a *args non-named list parameter instead of a tuple parameter.
So this should fail:

import petl as etl
table = [['foo', 'bar'],
        ['a', 1, 1],
        ['b', 2, 2],
        ['b', 2, 3],
        ['b', 3, 3],
        ['c', 4, 4]]

some_fields = ( 'foo', 'bar' )

ok = etl.valuecounter(table, 'foo', 'bar' )

ok = etl.valuecounter(table, *some_fields )  # notice the * deconstruction operator

fails = etl.valuecounter(table, some_fields )

Is this the case?

@juarezr juarezr added Can't Reproduce Needs more information to reproduce or locate the problem and removed Help Wanted We are volunteers. We'll be happy if you join us. labels Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It must work in all situations, but this failed Can't Reproduce Needs more information to reproduce or locate the problem
Projects
None yet
Development

No branches or pull requests

2 participants