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

Null issue check throwing an error #1063

Open
sanjanag opened this issue Mar 26, 2024 · 1 comment
Open

Null issue check throwing an error #1063

sanjanag opened this issue Mar 26, 2024 · 1 comment
Labels
bug Something isn't working help-wanted We need your help to add this, but it may be more challenging than a "good first issue"

Comments

@sanjanag
Copy link
Member

Error

Error in null: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Failed to check for these issue types: [NullIssueManager]

Dataset: https://www.kaggle.com/datasets/laotse/credit-risk-dataset/data

import pandas as pd
from cleanlab import Datalab
from sklearn.preprocessing import StandardScaler

if __name__ == "__main__":
    df = pd.read_csv("/Users/sanjana/cleanlab_home/sandbox/regression-tests/credit_risk_dataset.csv")
    # df = df[~df.isnull().any(axis=1)].copy()
    feature_columns = df.columns.to_list()
    feature_columns.remove("loan_status")

    X_raw = df[feature_columns]
    labels = df["loan_status"]

    cat_features = [
        "person_home_ownership",
        "loan_intent",
        "loan_grade",
        "cb_person_default_on_file",
    ]
    numeric_features = [
        "person_age",
        "person_income",
        "person_emp_length",
        "loan_amnt",
        "loan_int_rate",
        "loan_percent_income",
        "cb_person_cred_hist_length",
    ]
    X_encoded = pd.get_dummies(X_raw, columns=cat_features, drop_first=True)
    scaler = StandardScaler()
    X_processed = X_encoded.copy()
    X_processed[numeric_features] = scaler.fit_transform(X_encoded[numeric_features])

    lab = Datalab({"X": X_processed.values, "y": labels})

    lab.find_issues(features=X_processed.values, issue_types = {"null": {}})
@sanjanag
Copy link
Member Author

Suggestion:
Change np.isnan(features) to pd.isnull(features) here

@jwmueller jwmueller added bug Something isn't working help-wanted We need your help to add this, but it may be more challenging than a "good first issue" and removed needs triage labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help-wanted We need your help to add this, but it may be more challenging than a "good first issue"
Projects
None yet
Development

No branches or pull requests

2 participants