pyprocessmacro icon indicating copy to clipboard operation
pyprocessmacro copied to clipboard

[feature] Automatically cast categorical variable as integer

Open louisabraham opened this issue 2 years ago • 0 comments

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"])

louisabraham avatar Feb 16 '23 17:02 louisabraham