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 remove duplicating rows from python prettytable?

I use the Following code to enter data from mysql database and display it in python shell. I used prettytable to make look pretty. But now I'm stuck with this bug where the rows from prettytable keep repeating itself if I call the display function…
Ayush Raj
  • 3
  • 3
0
votes
1 answer

How to create a table with different number of rows using prettytable module python

I have the following code to generate a table using PrettyTable: from prettytable import PrettyTable # columns names columns = ["Characters", "FFF", "Job"] # lists lista1 = ["Leanord", "Penny", "Howard", "Bernadette", "Sheldon", "Raj"] lista2 =…
brenda
  • 656
  • 8
  • 24
0
votes
1 answer

PrettyTable add_row() Not Printing the Table Body

To the best of ability I couldn't recognize why PrettyTable add_row method is not printing the table body in this my Python 3 code. It is a program to evaluate truth table and print the table out. If I use print function, I am able to print the data…
0
votes
1 answer

How to access a particular element in prettytable in python?

I am trying to access a particular element say in row=1 and column=2 ..how can I access elements like dat in pretty table in python?
0
votes
1 answer

Using PrettyTable to print out details of Python files in directory

I'm attempting to write a FileAnalyzer class that would search a directory for Python files and provide details of each Python file in the form of a PrettyTable. I'm interested in the number of classes, functions, lines, and characters in each…
Jim T
  • 65
  • 5
0
votes
1 answer

Generate benchmark table

I have generated benchmarks for comparing two approaches taken for scaling video files using ffmpeg tool. The benchmarks are logged in this format : x.mp4 Output_Resolution : 10 p Parameter1 : a Method : A real 0m5.788s user 0m16.112s sys …
Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50
0
votes
1 answer

How do you enter numbers into a table using loops?

I have tables assessing the quality of classification for 6 models at the same time. It annoys me that the code takes up so much space. That is why I would like to ask if anyone could introduce this with a loop. from prettytable import…
Wojciech Moszczyński
  • 2,893
  • 21
  • 27
0
votes
1 answer

How to do same commands but in different iteration styles with if-condition? (Python, code optimization)

So, I've got this code: t = PrettyTable(['first', 'second']) if condition: for i in data_set[::-1]: t.add_row([i['first'], i['second']) # ... (multiple other commands) else: for i in data_set: …
jkeeraa
  • 129
  • 2
  • 9
0
votes
1 answer

TypeError: '<' not supported between instances of 'str' and 'float' - Prettytable Error

I'm getting the above error trying to run my Py script. It also throws error in the prettytable code which is weird, as well, since I use it fine all the time. This is basically a web-scraping script that I made for use with an airline manager game…
0
votes
1 answer

Python PrettyTable - enter a value into column once and update count of its occurrences

I have created a pretty table as below: from prettytable import PrettyTable from datetime import datetime, timedelta, timezone # objects my_table = PrettyTable() my_table.field_names = ["Permit_Type", "Count"] permit_type_list = ["P1", "R4", "P1",…
Hamza
  • 2,180
  • 3
  • 14
  • 18
0
votes
1 answer

How to sum a column and add it as footer using prettytable

I want the sum of the last column ( ie., Column " E ") and add that as a footer. How to do it? I didn't find any specific function for the same. Though I found a similar post, which wasn't helpful. def printCSVRow(argument1, argument2,…
kutty
  • 37
  • 1
  • 1
  • 8
0
votes
1 answer

Adding Information to columns with prettytable

I am looking to create a scoring system, and I am using prettytable to do so. I add all the scores to the table and then order them by their score. This works perfectly except for when I include their position (1, 2, 3, 4 etc.) If their position is…
0
votes
1 answer

Won't print a combination of int and str

Dumb script to calculate the savings when buying bulk medical flower. Tried wrapping it in str() to see if that converted it all into a string so it could print(). from prettytable import PrettyTable print("*Enter with spaces seperating") …
JoshPaulie
  • 78
  • 1
  • 7
0
votes
1 answer

How do i merge table index name using pandas in python?

I want to set two columns with their index in a single index. But i can not merge table index. How could i merge table index using pandas or row python code? I tried and get this https://ibb.co/7nZyxCM Here is the sample code using PrettyTable…
Royel
  • 11
  • 4
0
votes
1 answer

Python Column / Fieldnames combine

I want to create a table with 2 headings but 5 entries / columns and get this problem: Exception("Row has incorrect number of values, (actual) %d!=%d (expected)" %(len(row),len(self._field_names))) Exception: Row has incorrect number of values,…
Jonas Liddell
  • 31
  • 1
  • 2