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

Standardize(x) comes before drop na #208

Open
michelegentili93 opened this issue May 28, 2024 · 0 comments
Open

Standardize(x) comes before drop na #208

michelegentili93 opened this issue May 28, 2024 · 0 comments

Comments

@michelegentili93
Copy link

michelegentili93 commented May 28, 2024

It looks like Standardize(x) comes before drop_na --> therefore the standardization returns all nan

import numpy as np
import pandas as pd
from patsy import dmatrix

df = pd.DataFrame({'x1': np.arange(5), 'x2': [1,2,np.nan,5,6]})

output:
dmatrix("~x1+x2", df)
[[1. 0. 1.]
[1. 1. 2.]
[1. 3. 5.]
[1. 4. 6.]]

dmatrix("~x1+standardize(x2)", df)
DesignMatrix with shape (0, 3)
Intercept x1 standardize(x2)
Terms:
'Intercept' (column 0)
'x1' (column 1)
'standardize(x2)' (column 2)

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