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

Table.homogenize errors on tuple input for default row #699

Closed
Mr-F opened this issue Nov 21, 2017 · 3 comments
Closed

Table.homogenize errors on tuple input for default row #699

Mr-F opened this issue Nov 21, 2017 · 3 comments
Labels

Comments

@Mr-F
Copy link

Mr-F commented Nov 21, 2017

Hey,

I've just started to explore agate and so far it seems great. However, I hit a situation where I wanted to fill in the missing dates in a time series I have. I believe the solution would be to homogenize to fill in the missing value as per the example in the tutorial (http://agate.readthedocs.io/en/1.6.0/cookbook/homogenize.html). However trying my own code I kept getting the following error:

AttributeError: 'tuple' object has no attribute 'insert'

So I've attempted to use the sample in the example, but can't get this working either.

data = [
    {'year': 1997, 'female_count': 2, 'male_count': 1},
    {'year': 2000, 'female_count': 3, 'male_count': 3}
]
key = 'year'
expected_values = (1997, 1998, 2000)
default_row = (0, 0)
t = agate.Table.from_object(data)
t.homogenize(key, expected_values, default_row).print_table()

Am I'm missing something or is there an issue with this?

@nbedi
Copy link
Member

nbedi commented Nov 21, 2017

Looks like a bug (two bugs, found a second while looking into this). If you make default_row a list instead of a tuple, the homogenize function will work.

But it looks like there is a second bug once you try to print the table. You may need to avoid using this for now. Thanks for reporting!

@nbedi nbedi added the bug label Nov 21, 2017
@nbedi nbedi changed the title Homogenize error Table.homogenize errors on tuple input for default row Nov 21, 2017
@Mr-F
Copy link
Author

Mr-F commented Nov 21, 2017

Thanks for the quick response. I was hoping it was me, but if there is anything I can do to help with this let me know

@jpmckinney
Copy link
Member

I think fixed by #710.

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

No branches or pull requests

3 participants