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

Error #2

Open
aalb1970 opened this issue Feb 20, 2024 · 0 comments
Open

Error #2

aalb1970 opened this issue Feb 20, 2024 · 0 comments

Comments

@aalb1970
Copy link

I'm trying to weight a datset using the following code:

import weightipy as wp

Targets

gender_targets = {'Q2':{1:49, 2:51}}
region_targets = {'Q4':{1:32, 2:23, 3:10, 4:14, 5:21}}
scheme = wp.Rim('gender_and_age')
scheme.set_targets(targets=[gender_targets, region_targets])

df["respid"] = range(len(df))
engine = wp.WeightEngine(data=df)
engine.add_scheme(scheme=scheme, key="respid", verbose=False)
engine.run()
df_weighted = engine.dataframe()
col_weights = f"weights_{scheme.name}"

respid, Q2, Q3 and Q4 are integer columns.

I get a long error message beginning with:

FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.

Further down after a series of floating point numbers the error states:

has dtype incompatible with int64, please explicitly cast to a compatible dtype first.

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

1 participant