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

Strange buffer error #1684

Closed
hdoupe opened this issue Nov 19, 2017 · 4 comments
Closed

Strange buffer error #1684

hdoupe opened this issue Nov 19, 2017 · 4 comments

Comments

@hdoupe
Copy link
Collaborator

hdoupe commented Nov 19, 2017

I'm getting a non-fatal ValueError exception when I run the following script.

import taxcalc

kw = {
    'start_year': 2017,
    'use_full_sample': True,
    'user_mods': {
        u'policy': {
            2017: {
                u'_ALD_InvInc_ec_base_RyanBrady': [False],
                u'_NIIT_PT_taxed': [False],
                u'_ID_BenefitCap_Switch': [[1, 1, 1, 1, 1, 1, 1]],
                u'_PT_wages_active_income': [False],
                u'_EITC_indiv': [False],
                u'_CG_nodiff': [False],
                u'_ID_BenefitSurtax_Switch': [[1, 1, 1, 1, 1, 1, 1]],
                u'_DependentCredit_before_CTC': [False],
                u'_PT_top_stacking': [True],
                u'_ID_AmountCap_Switch': [[1, 1, 1, 1, 1, 1, True]],
                u'_II_no_em_nu18': [False],
                u'_CTC_new_for_all': [True],
                u'_CTC_new_refund_limited': [True]
            }
        },
        u'growdiff_response': {},
        u'behavior': {},
        u'consumption': {},
        u'growdiff_baseline': {}
    },
    'year_n': 6,
    'use_puf_not_cps': False
}


res = taxcalc.tbi.run_nth_year_tax_calc_model(**kw)

import pandas as pd
import numpy as np

print("PANDAS VERSION ", pd.__version__)
print("NUMPY VERSION ", np.__version__)
(aei_dropq) HDoupe-MacBook-Pro:PolicyBrain henrydoupe$ python buffer_issue.py 
cps-read-time= 7.1
You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
seed=3426454162
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
elapsed time for this run: 223.5
('PANDAS VERSION ', u'0.21.0')
('NUMPY VERSION ', '1.12.1')

I still get what seems like the correct result, but I get those error messages, too. This seems like it could be an environment issue. Can someone else run this to confirm (or refute) this theory?

Also, I'm running taxcalc 0.13.2.

@martinholmer
Copy link
Collaborator

@hdoupe, I get the same results:

iMac:tcwork mrh$ python hd.py
cps-read-time= 3.3
You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
seed=3426454162
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'
Exception ValueError: "Buffer dtype mismatch, expected 'Python object' but got 'long'" in 'pandas._libs.lib.is_bool_array' ignored
elapsed time for this run: 140.5
('PANDAS VERSION ', u'0.21.0')
('NUMPY VERSION ', '1.13.3')
iMac:tcwork mrh$ 

@martinholmer
Copy link
Collaborator

@hdoupe,
Looks like #1684 might be more Pandas funny business.
See the conversation here and this recent Pandas pull request.
I can't tell if the pull request was supposed to be in Pandas 0.21.0 or 0.21.1.
I'd ignore this for now; there are many more important issues at hand.

@hdoupe
Copy link
Collaborator Author

hdoupe commented Nov 19, 2017

@martinholmer thanks for looking into this. You're right. Hopefully, this doen't affect the results at all. When testing PB 1.2.0, we will need to keep this in mind.

@martinholmer
Copy link
Collaborator

@hdoupe said in issue #1684:

thanks for looking into this. You're right. Hopefully, this doesn't affect the results at all. When testing PB 1.2.0, we will need to keep this in mind.

Seems sensible. So, I'm going to close this issue under the assumption that you're focusing on this matter in the PolicyBrain repository.

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

No branches or pull requests

2 participants