Questions tagged [prettytable]

A simple Python library for easily displaying tabular data in a visually appealing ASCII table format.

PrettyTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables. It was inspired by the ASCII tables used in the PostgreSQL shell psql.

PrettyTable allows for selection of which columns are to be printed, independent alignment of columns (left or right justified or centred) and printing of “sub-tables” by specifying a row range.

https://pypi.python.org/pypi/PrettyTable

155 questions
0
votes
1 answer

How to save datetime object prettytable to sort as date instead of like a string

I have the following prettytable: import operator from prettytable import PrettyTable table = PrettyTable(["Name","Month", "Grade"]) table.title="title test" table.add_row(["Joe","Jan", 90]) table.add_row(["Sally", "Feb",…
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
0
votes
1 answer

Fill Python's prettytable using lists

I need to create a table of summary statistics using Python's prettytable. I have a dataset of n columns and I need to compute the mean, median, standard deviation and variance of each of the columns. I can use numpy to calculate a list of…
0
votes
1 answer

Create table with add_columns in PrettyTable

I am trying to create a table of performance metrics using PrettyTable. Given the table layout, it would be best to fill the table by column using a list of metrics and a list of values with the add_column option. However, when I try to do that, the…
0
votes
1 answer

How to fix prettytable installation

I can install, uninstall and upgrade prettytable using pip [un]install [-U] prettytable. But running the mbed-tools compile command keeps on reporting "ModuleNotFoundError: No module named 'prettytable'" I can see the package is added to my…
Willie Visagie
  • 171
  • 1
  • 14
0
votes
1 answer

Plotting PrettyTable inside a matplotlib plot

I am trying to plot PrettyTable inside a matplotlib. Here is my code: import numpy as np import matplotlib.pyplot as plt from prettytable import PrettyTable myTable = PrettyTable(["Student Name", "Class", "Section", "Percentage"]) # Add…
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
0
votes
2 answers

Printing data in Tabular Form in Python

I'm trying to look for accuarcy/PRecision/Reacll etc... So i used this code and it works verry well for me but actually i want to change the output form as tabular My output: Column 2 acc: 1.0 Column 2 p: 1.0 Column 2 r: 1.0 Column 1…
user16486968
0
votes
2 answers

Tabulating the results in the terminal using PrettyTable

I have the following code for the Babylonian method: number = abs(float(125348)) guess = abs(float(600)) epsilon = 0.001 while True: difference = guess**2 - number print('{} : {}'.format(round(guess, 4), round(difference, 4))) if…
Jessie
  • 65
  • 7
0
votes
1 answer

Is it possible to color a table in PrettyTable?

I am creating a small game in the console, using PrettyTable, but I can not find information on how to color the table. I know that you can make a color table in Tkinter, but I need it exactly without using it Here is a piece: def draw_board(): …
0
votes
1 answer

Python Add data from array to prettytable via column

I created an array full of number. I want to add data from the array to the prettytable basically using add_columns number=[1,2,3,4,5,6,7,8,9,.....,100] I want the output of the pretty table to be like this…
0
votes
1 answer

How do I add my dictionary to prettytable

I have two files students and grades that has to be read and converted to a dictionary and finally print to a prettytable: Grades: 10103 SSW 567 A 98765 10103 SSW 564 A- 98764 10103 CS 501 B 98764 10115 SSW 567 A 98765 10115 SSW…
Swayam Shah
  • 119
  • 1
  • 8
0
votes
1 answer

Prettytable module doesn't render properly when the numbers of rows are huge

I am trying to print almost 100 rows using Prettytable to slack channel. Before sending it to slack channel , I am modifying the table to string and sending :: Finaltable = '````' + table.get_string() + '```' But the data is very dislocated. It…
Prathibha Nag
  • 21
  • 1
  • 4
0
votes
0 answers

i am trying to connect sql and python and trying to display the database with pretty table but this error is occurring

t = x(['Emp.no','Emp_name','Designation','Salary','Commission']) TypeError: 'PrettyTable' object is not callable
0
votes
1 answer

How to erase middle vertical line in prettytable, Python?

I printed this table. I can do it only for first string with installed PTable. def table_example(): """It is needed to install PTable to have title line""" table = PrettyTable() table.title = 'Results for method' table.field_names = ['EWRWE',…
0
votes
1 answer

Print PrettyTable data to QPlainTextEdit

My setup is Windows 10, Python 3.7, PyQt5 The goal is to print a formatted table to a QPlainTextEdit. I have some data in a PrettyTable object. When I print this data to stdout, the table gets printed perfectly! But when printing to QPlainTextEdit…
0
votes
2 answers

Print the PrettyTable in color

Would it be possible to print the table in color, for example frames with HTML notation: 66a1d7 and text: f09d52? from prettytable import PrettyTable people = {1: {'name': 'John', 'age': '27', 'city': 'London', 'sex': 'Male', 'married': 'Yes',…