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

[feature] Automatically cast categorical variable as integer #24

Open
louisabraham opened this issue Feb 16, 2023 · 0 comments
Open

[feature] Automatically cast categorical variable as integer #24

louisabraham opened this issue Feb 16, 2023 · 0 comments

Comments

@louisabraham
Copy link

Here is my code:

from pyprocessmacro import Process

df["present_narration_bin"] = (
    df["present_narration"] == "high present narration"
).astype(float)
p = Process(data=df, model=4, x="present_narration_bin", y="attitude", m=["credible"])

df.present_narration has type:

Name: present_narration, Length: 505, dtype: category
Categories (2, object): ['high present narration', 'low present narration']

statsmodels automatically casts it to float so I thought it would be nice to be able to write:

p = Process(data=df, model=4, x="present_narration", y="attitude", m=["credible"])
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