[Python] Python running probit model: len() of unsized object

Discussão em 'Python' iniciado por Stack, Abril 30, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run a super simple python script where I pull data from a sql query and then extract the appropriate variables to run a probit on. nl and the variable names listed in cols are all long values.

    import statsmodels.api as smf
    import numpy as np
    import pandas as pd
    df = spark.sql("select * from knn_df")
    cols=['constant','clnt_tenure_0_1', 'clnt_tenure_2_5', 'clnt_tenure_6_9',
    'clnt_tenure_10_19', 'clnt_tenure_20p']
    X = df[cols]
    X = np.array(X)
    y = df[['nl']]
    y= np.array(y)
    probit_model = smf.Probit(y,X)
    result=probit_model.fit()
    print(result.summary2())


    When running this code I get the error "len() of unsized object". Any help would be appreciated.

    Continue reading...

Compartilhe esta Página