Closed alistairewj closed 6 years ago
We can implement this, but is there a reason why you wouldn't just omit the categorical argument altogether?
e.g.
# only continuous variables
import pandas as pd
import numpy as np
from tableone import TableOne
n = 10000
data_sample = pd.DataFrame(index=range(n))
mu, sigma = 10, 1
data_sample['normal'] = np.random.normal(mu, sigma, n)
data_sample['nonnormal'] = np.random.noncentral_chisquare(20,nonc=2,size=n)
TableOne(data_sample, continuous = ['normal', 'nonnormal'], nonnormal=['nonnormal'])
Outputs:
Overall
overall
------------------------ -------------------
n 10000
normal (mean (std)) 10.00 (1.00)
nonnormal (median [IQR]) 21.23 [17.04,26.30]
Instead of requiring an empty list, it would seem appropriate to allow the
continuous
andcategorical
inputs to beNone
. At the moment this will throw an error. Example: