Skip to content

Standardize(x) comes before drop na #208

@michelegentili93

Description

@michelegentili93

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions