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
1
vote
1 answer

Is it possible to get Boto3 | python output in tabular format

in aws cli we can set output format as json or table. Now I can get json output from json.dumps is there anyway could achieve output in table format? I tried pretty table but no success
Ahsan Naseem
  • 1,046
  • 1
  • 19
  • 38
1
vote
1 answer

Using terminaltables, how can I get all my data in a single table, rather than split across multiple tables?

I’m having a problem printing a table with terminaltables. Here's my main script: from ConfigParser import SafeConfigParser from terminaltables import AsciiTable parser = SafeConfigParser() parser.read('my.conf') for section_name in…
mitm
  • 31
  • 4
0
votes
0 answers

PrettyTable library is not working when using official source code from GitHub

I am getting this error when using the prettytable library on my virtual machine. File "lib_report.py", line 7, in from prettytable import PrettyTable File "/users/ssri/Documents/prettytable.py", line 137 self._field_names: list[str] = [] …
0
votes
1 answer

Is there a way to work with tabulate and jinja2?

I have this issue where I use PrettyTable to generate tables with content coming from a json fileJson file I get the correct layout in terminalPrinting in terminal but when i put it inside a jinja file the spacing are messed upOutput of jinja using…
Kenny
  • 3
  • 2
0
votes
0 answers

building a table base on data in a csv file in python

I want to build a table and print it on the console based on the data from a CSV file and the data may change so I need to update the value in rows when the data in the CSV file changes. This is the code that I end up with each time the loop…
Poori
  • 31
  • 5
0
votes
0 answers

How to remove duplicate rows in pretty table

There are multiple duplicate rows in the pretty table that I created. Is there a way to remove these duplictaed like in a datframe? I tried sorting and removing or directly removing from the dictionary. But is there any other way to remove…
Groot
  • 1
0
votes
0 answers

How to center a PrettyTable table in python?

I have some example code for PrettyTable module but I was wondering if there was a way to center the table in the middle of the terminal. Code: from prettytable import PrettyTable # Create a new table with column names "City" and "Country" table =…
user19533273
0
votes
0 answers

How to convert data output from PrettyTable Text file to CSV or Excel

a less experienced programmer here trying to make some headway on a python project I have started. I have a background in finance but am trying to tie python in to expand myself professionally. But I am trying to access the Bureau of Labor…
0
votes
0 answers

i am trying to use prettytable but it is giving me a field row along the top that i do not want

when i put in my code i am getting a row along the top that i do not know how to get rid of this is the code: import prettytable def front_end(): # Create a new table table = prettytable.PrettyTable() # Add the rows of the array to the…
0
votes
0 answers

How to merge two raws (cells) with prettytable lib in python?

I would like to know if it is possible to merge the content of two cells with the PrettyTable lib. I've searched and searched on the net but I didn't find anything ^^ So either the feature doesn't exist or I'm doing my research wrong (not the right…
nitnit
  • 1
0
votes
1 answer

Merging Two Tables with pretty table

After scrapping with beautiful soup, I have 2 tables : x = PrettyTable() x.field_names = ['Titre', 'Price'] y = PrettyTable() y.field_names = ['Description'] OUTPUT: x = +-----------------+ | Titre | Price | +-----------------+ | a …
Bruno93600
  • 53
  • 8
0
votes
1 answer

not able to print contents of sql table in python using pretty table

import os import time import mysql.connector as ms from prettytable import from_db_cursor mydb=ms.connect(host="localhost",user="root",passwd="12345") mycursor=mydb.cursor() x=input("DATABASE NAME : ") mycursor.execute("show…
0
votes
1 answer

How to send prettytable through email using python

I have created a prettytable in python and I have to send the output of prettytable through email env = "Dev" cost = 25.3698 line = [env, "${:,.2f}".format(cost)] totalcostofenv = PrettyTable(['Environment',…
Bhavesh R
  • 23
  • 5
0
votes
4 answers

How to limit digits in 9 by 9 matrix Julia

How can I limit the digits of data matrix to 2 digits? data = reshape([tuple(c[i], c2[i]) for i in eachindex(c, c2)], 9, 9) #9×9 Matrix{Tuple{Real, Real}}: hl = Highlighter((d,i,j)->d[i,j][1]*d[i,j][2] < 0, crayon"red") pretty_table(data ; header…
Hana
  • 101
  • 5
0
votes
1 answer

converting vectors to data structure in Julia

I have 2 vectors of 81 values each. and want to save them in a data structure 9 by 9 so that when I use pretty tables to print it I got the following picture (without converting numbers to string and hard coding "," between them) global c= …
Hana
  • 101
  • 5