(*frames)
Check if inputs are pd.Series or pd.DataFrame with same indices / columns.

        Parameters
        ----------
        frames : list
            Elements are either `pd.Series` or `pd.DataFrame`.

        Raises
        ------
        TypeError
            If elements are not `pd.Series` or `pd.DataFrame`.

        IndexError
            If indices/colums do not agree.
Check if inputs are pd.Series or pd.DataFrame with same indices / columns.
Check if inputs are pd . Series or pd . DataFrame with same indices / columns .
def check_indices_agree(*frames):
        """Check if inputs are pd.Series or pd.DataFrame with same indices / columns.

        Parameters
        ----------
        frames : list
            Elements are either `pd.Series` or `pd.DataFrame`.

        Raises
        ------
        TypeError
            If elements are not `pd.Series` or `pd.DataFrame`.

        IndexError
            If indices/colums do not agree.

        """
        if not all([isinstance(x, (pd.Series, pd.DataFrame)) for x in frames]):
            raise TypeError('Some elements are not pd.Series or pd.DataFrame')

        reference_index = frames[0].index

        for i, f in enumerate(frames):
            if not f.index.equals(reference_index):
                raise IndexError('The {} entry has wrong index: {}'.format(i, f.index))

            if isinstance(f, pd.DataFrame) and not f.columns.equals(reference_index):
                raise IndexError('The {} entry has wrong columns: {}'.format(i, f.columns))
def check_indices_agree ( * frames ) : if not all ( [ isinstance ( x , ( pd . Series , pd . DataFrame ) ) for x in frames ] ) : raise TypeError ( 'Some elements are not pd.Series or pd.DataFrame' ) reference_index = frames [ 0 ] . index for i , f in enumerate ( frames ) : if not f . index . equals ( reference_index ) : raise IndexError ( 'The {} entry has wrong index: {}' . format ( i , f . index ) ) if isinstance ( f , pd . DataFrame ) and not f . columns . equals ( reference_index ) : raise IndexError ( 'The {} entry has wrong columns: {}' . format ( i , f . columns ) )