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

Fix homogenize not working with tuples #710

Merged
merged 1 commit into from Mar 31, 2020

Conversation

Zeroji
Copy link
Contributor

@Zeroji Zeroji commented Jan 24, 2018

Also fixes data corruption bug due to lists being mutable.

With agate 1.6.0, default homogenize example:

>>> table.homogenize('year', range(1997, 2003), (0, 0))
AttributeError: 'tuple' object has no attribute 'insert'
>>> table.homogenize('year', range(1997, 2003), [0, 0])
(('year', Decimal('1997')), ('f', Decimal('2')), ('m', Decimal('1')))
(('year', Decimal('2000')), ('f', Decimal('4')), ('m', Decimal('3')))
(('year', Decimal('2002')), ('f', Decimal('4')), ('m', Decimal('5')))
(('year', Decimal('2003')), ('f', Decimal('1')), ('m', Decimal('2')))
(('year', 1999), ('f', 0), ('m', 0))
(('year', 1998), ('f', 1999), ('m', 0))
(('year', 2001), ('f', 1998), ('m', 1999))

With fix (for both tuples and list arguments):

(('year', Decimal('1997')), ('f', Decimal('2')), ('m', Decimal('1')))
(('year', Decimal('2000')), ('f', Decimal('4')), ('m', Decimal('3')))
(('year', Decimal('2002')), ('f', Decimal('4')), ('m', Decimal('5')))
(('year', Decimal('2003')), ('f', Decimal('1')), ('m', Decimal('2')))
(('year', 1999), ('f', 0), ('m', 0))
(('year', 1998), ('f', 0), ('m', 0))
(('year', 2001), ('f', 0), ('m', 0))

Edit: fixes (hopefully) #699

Also fixes data corruption bug due to lists being mutable.
@jpmckinney jpmckinney merged commit 8165245 into wireservice:master Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants