    def show(self, limit=5, tablefmt=None):
        """Print the first n lines of a DataCollection.

        Args:
            limit (int, optional): The number of lines to print. Prints all if limit is negative. Defaults to 5.
            tablefmt (str, optional): The format of the output, supports html, grid.
        """

        if not tablefmt:
            try:
                _ = get_ipython().__class__.__name__
                tablefmt = 'html'
            except NameError:
                tablefmt = 'grid'

        if tablefmt == 'html':
            from towhee.utils.html_table import NestedHTMLTable # pylint: disable=import-outside-toplevel
            NestedHTMLTable(self.prepare_table_data(limit)).show()
        else:
            from towhee.utils.console_table import NestedConsoleTable # pylint: disable=import-outside-toplevel
            NestedConsoleTable(self.prepare_table_data(limit)).show()
Print the first n lines of a DataCollection.

Args:
limit (int, optional): The number of lines to print. Prints all if limit is negative. Defaults to 5.
tablefmt (str, optional): The format of the output, supports html, grid.
towhee/datacollection/mixins/display.py