def __getitem__(self, key):
        """
        Get a column or row from the dataset.

        Args:
            key (str or int): String referencing a column or integer referencing a row
        Returns:
            :class:`list` or :class:`dict`: List of column values or a dict representing a row
        """
        # Given an column string return list of column values.
        if isinstance(key, str):
            if key not in self.columns:
                raise AttributeError('Key not in columns.')
            return [row[key] if key in row else None for row in self.rows]
        # Given an row integer return a object of row values.
        elif isinstance(key, (int, slice)):
            return self.rows[key]
        else:
            raise TypeError('Invalid argument type.')
def __getitem__ ( self , key ) : if isinstance ( key , str ) : if key not in self . columns : raise AttributeError ( 'Key not in columns.' ) return [ row [ key ] if key in row else None for row in self . rows ] elif isinstance ( key , ( int , slice ) ) : return self . rows [ key ] else : raise TypeError ( 'Invalid argument type.' )
Get a column or row from the dataset.

        Args:
            key (str or int): String referencing a column or integer referencing a row
        Returns:
            :class:`list` or :class:`dict`: List of column values or a dict representing a row