Closed tompollard closed 5 years ago
Starting with the following dataframe:
df = pd.DataFrame({'feature': [True,False,False,True], 'id': [1,0,1,2]})
and then counting the values using melt:
df.melt().groupby(['variable','value']).size().to_frame(name='freq')
Outputs:
This post suggests that the operation casts the values to object, and that pandas treats 0/1 as boolean for object conversion (which seems odd!).
As a result tableone currently displays False/True instead of 0/1 for the sample data:
t = TableOne(df, columns=['feature','id'], categorical=['feature','id'])
Starting with the following dataframe:
and then counting the values using melt:
Outputs:
This post suggests that the operation casts the values to object, and that pandas treats 0/1 as boolean for object conversion (which seems odd!).
As a result tableone currently displays False/True instead of 0/1 for the sample data: