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

reformat for python3 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions woe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,4 @@ def change_config_var_dtype(self,var_name,type,inplace_file=True):
if type in ['object','string','int64','uint8','float64','bool1','bool2','dates','category']:
self.variable_type.loc[var_name,'v_type'] = type
else:
raise KeyError,"Invalid dtype specified! "











raise (KeyError,"Invalid dtype specified! ")
14 changes: 7 additions & 7 deletions woe/feature_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ def change_feature_dtype(df,variable_type):
:return: None
'''
s = 'Changing Feature Dtypes'
print s.center(60,'-')
print (s.center(60,'-'))
for vname in df.columns:
try:
df[vname] = df[vname].astype(variable_type.loc[vname,'v_type'])
print vname,' '*(40-len(vname)),'{0: >10}'.format(variable_type.loc[vname,'v_type'])
print( vname,' '*(40-len(vname)),'{0: >10}'.format(variable_type.loc[vname,'v_type']))
except Exception:
print '[error]',vname
print( '[error]',vname)

s = 'Variable Dtypes Have Been Specified'
print s.center(60,'-')
print (s.center(60,'-'))

return

Expand Down Expand Up @@ -250,7 +250,7 @@ def binning_data_split(df,var,global_bt,global_gt,min_sample,alpha=0.01):
#remove max value and min value in case dataset_r or dataset_l will be null
for point in percent_value[0:len(percent_value)-1]:
# If there is only a sample or a negative sample, skip
if len(set(df[df[var] > point]['target'])) == 1 or len(set(df[df[var] <= point]['target'])) == 1\
if len(set(df[df[var] > point]['target'])) == 1 or len(set(df[df[var] <= point]['target'])) == 1 \
or len(df[df[var] > point]) < min_sample or len(df[df[var] <= point]) < min_sample :
continue

Expand Down Expand Up @@ -399,7 +399,7 @@ def proc_woe_discrete(df,var,global_bt,global_gt,min_sample,alpha=0.01):
:return:
'''
s = 'process discrete variable:'+str(var)
print s.center(60, '-')
print (s.center(60, '-'))
div = DisInfoValue()
div.var_name = var
rdict = {}
Expand Down Expand Up @@ -463,7 +463,7 @@ def proc_woe_continuous(df,var,global_bt,global_gt,min_sample,alpha=0.01):
:return:
'''
s = 'process continuous variable:'+str(var)
print s.center(60, '-')
print( s.center(60, '-'))
iv_tree = binning_data_split(df, var,global_bt,global_gt,min_sample,alpha)

# Traversal tree, get the segmentation point
Expand Down