'Construct a Table object from data.
Parameters
data : array-like
The raw data, from which a contingency table is constructed
using the first two columns.
shift_zeros : boolean
If True and any cell count is zero, add 0.5 to all values
in the table.
Returns
A Table instance.'

@classmethod
def from_data(cls, data, shift_zeros=True):

    if isinstance(data, pd.DataFrame):
        table = pd.crosstab(data.iloc[:, 0], data.iloc[:, 1])
    else:
        table = pd.crosstab(data[:, 0], data[:, 1])
    return cls(table, shift_zeros)
