Binning_table in BinningProcess does not generate result from DataFrame in Python Pandas?

Hellow I work with Optimal Binning and I have to problem to generate optb.binning_table.build() because I do not any output and any any error!

I have DataFrame like below:

df = pd.DataFrame({"var1" : ["a", "b"],
               "var2" : ["c", "d"],
               "var3" : [1, 0],
               "var4" : [56, 18]})

And code like below:

from optbinning import BinningProcess

toob = ["var1", "var2"]
binning_process = BinningProcess(variable_names=toob)
binning_process.fit(df[toob], df["var3"])

for variable in toob:
    optb = binning_process.get_binned_variable(name=variable)
    optb.binning_table.build()
#     optb.binning_table.plot()
#     optb.binning_table.analysis()

enter image description here

optb.binning_table.plot() - works - generates result

optb.binning_table.analysis() - works - generates result

optb.binning_table.build() - does not work! does not give any result or erro.

What can I do to generate result from my optimal binning code to generate binning_table ?

1 answer

  • answered 2021-01-11 05:32 U11-Forward

    You need to use print as well, so:

    print(optb.binning_table.build())
    

    Would work.