How to use the prettytable.from_csv function in prettytable

To help you get started, we’ve selected a few prettytable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github columbia / fairtest / src / fairtest / modules / bug_report / report.py View on Github external
Pretty-print a contingency table

    Parameters
    ----------
    ct :
        the contingency table

    Returns
    -------
    pretty_table :
        a fancier string representation of the table
    """
    output = StringIO()
    rich_ct(ct).to_csv(output)
    output.seek(0)
    pretty_table = prettytable.from_csv(output)
    pretty_table.padding_width = 0
    pretty_table.align = 'r'
    pretty_table.align[pretty_table.field_names[0]] = 'l'
    return pretty_table
github columbia / fairtest / src_new_api / fairtest / bugreport / clustering / display_clusters.py View on Github external
def pretty_ct(ct):
    output = StringIO()
    rich_ct(ct).to_csv(output)
    output.seek(0)
    pretty_table = prettytable.from_csv(output)
    pretty_table.padding_width = 0
    pretty_table.align = 'r'
    pretty_table.align[pretty_table.field_names[0]] = 'l'
    return pretty_table
github columbia / fairtest / src / fairtest / bugreport / clustering / display_clusters.py View on Github external
def pretty_ct(ct):
    output = StringIO()
    rich_ct(ct).to_csv(output)
    output.seek(0)
    pretty_table = prettytable.from_csv(output)
    pretty_table.padding_width = 0
    pretty_table.align = 'r'
    pretty_table.align[pretty_table.field_names[0]] = 'l'
    return pretty_table
github kxxoling / PTable / tests / test_prettytable.py View on Github external
def setUp(self):
        csv_string = """City name, Area , Population , Annual Rainfall
        Sydney, 2058 ,  4336374   ,      1214.8
        Melbourne, 1566 ,  3806092   ,       646.9
        Brisbane, 5905 ,  1857594   ,      1146.4
        Perth, 5386 ,  1554769   ,       869.4
        Adelaide, 1295 ,  1158259   ,       600.5
        Hobart, 1357 ,   205556   ,       619.5
        Darwin, 0112 ,   120900   ,      1714.7"""
        csv_fp = StringIO.StringIO(csv_string)
        self.x = from_csv(csv_fp)
github tdamdouni / Pythonista / search / splunksearch.py View on Github external
searchstatus = res.read()
            isdonestatus = re.compile('isDone">(0|1)')
            isdonestatus = isdonestatus.search(searchstatus).groups()[0]
            if (isdonestatus == '1'):
                isnotdone = False

        print("got search status:  %s" % isdonestatus)

        searchserviceresults = '/services/search/jobs/%s/results?output_mode=csv&count=0' % sid
        req = urllib2.Request(url + searchserviceresults)
        req.add_header('Authorization', 'Splunk %s' % sessionkey)
        res = urllib2.urlopen(req)
        searchresults = res.read()
        results = StringIO.StringIO(searchresults)
        
        table = prettytable.from_csv(results)
        
        print(table)