#NEWLINE# @ classmethod #NEWLINE# def from_data( cls , data , shift_zeros = True ) : #NEWLINE# #INDENT# '\n        Construct a Table object from data.\n\n        Parameters\n        ----------\n        data : array-like\n            The raw data, from which a contingency table is constructed\n            using the first two columns.\n        shift_zeros : boolean\n            If True and any cell count is zero, add 0.5 to all values\n            in the table.\n\n        Returns\n        -------\n        A Table instance.\n        ' #NEWLINE# if isinstance ( data , pd . DataFrame ) : #NEWLINE# #INDENT# table = pd . crosstab ( data . iloc [ : , 0 ] , data . iloc [ : , 1 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# table = pd . crosstab ( data [ : , 0 ] , data [ : , 1 ] ) #NEWLINE# #UNINDENT# return cls ( table , shift_zeros )