MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / tabulate

Method tabulate

functional/pipeline.py:1724–1775  ·  view source on GitHub ↗

Return pretty string table of first n rows of sequence or everything if n is None. See https://bitbucket.org/astanin/python-tabulate for details on tabulate parameters :param n: Number of rows to show, if set to None return all rows :param headers: Passed to tabulat

(
        self,
        n=None,
        headers=(),
        tablefmt="simple",
        floatfmt="g",
        numalign="decimal",
        stralign="left",
        missingval="",
    )

Source from the content-addressed store, hash-verified

1722 return self.tabulate(10, tablefmt="html")
1723
1724 def tabulate(
1725 self,
1726 n=None,
1727 headers=(),
1728 tablefmt="simple",
1729 floatfmt="g",
1730 numalign="decimal",
1731 stralign="left",
1732 missingval="",
1733 ):
1734 """
1735 Return pretty string table of first n rows of sequence or everything if n is None. See
1736 https://bitbucket.org/astanin/python-tabulate for details on tabulate parameters
1737
1738 :param n: Number of rows to show, if set to None return all rows
1739 :param headers: Passed to tabulate
1740 :param tablefmt: Passed to tabulate
1741 :param floatfmt: Passed to tabulate
1742 :param numalign: Passed to tabulate
1743 :param stralign: Passed to tabulate
1744 :param missingval: Passed to tabulate
1745 """
1746 self.cache()
1747 length = self.len()
1748 if length == 0 or not is_tabulatable(self[0]):
1749 return None
1750
1751 if n is None or n >= length:
1752 rows = self.list()
1753 message = ""
1754 else:
1755 rows = self.take(n).list()
1756 if tablefmt == "simple":
1757 message = "\nShowing {} of {} rows".format(n, length)
1758 elif tablefmt == "html":
1759 message = "<p>Showing {} of {} rows".format(n, length)
1760 else:
1761 message = ""
1762 if len(headers) == 0 and is_namedtuple(rows[0]):
1763 headers = rows[0]._fields
1764 return (
1765 tabulate(
1766 rows,
1767 headers=headers,
1768 tablefmt=tablefmt,
1769 floatfmt=floatfmt,
1770 numalign=numalign,
1771 stralign=stralign,
1772 missingval=missingval,
1773 )
1774 + message
1775 )
1776
1777
1778def _wrap(value):

Callers 4

showMethod · 0.95
_repr_html_Method · 0.95
test_tabulateMethod · 0.80

Calls 6

cacheMethod · 0.95
lenMethod · 0.95
listMethod · 0.95
takeMethod · 0.95
is_tabulatableFunction · 0.90
is_namedtupleFunction · 0.90

Tested by 2

test_tabulateMethod · 0.64