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
0 answers

distance between columns in prettytable

I try to print my table in telegram bot. Due to the large distance between the columns on the phone, it looks terrible, not like a table Code: table = PrettyTable() table.set_style(PLAIN_COLUMNS ) table.hrules=ALL table.field_names = ['Станция',…
Kirysha
  • 25
  • 6
0
votes
0 answers

How can I edit the Text Size in a Python Pretty Print Table html string?

Suppose I have a sample table: myTable = PrettyTable([]) myTable.add_column("X", [2]) myTable.add_column("Y", [1]) myTable.get_html_string() How would I edit the font size in the table from the HTML string?
Alex S.
  • 1
  • 2
0
votes
2 answers

How to add a column as header in Julia using pretty tables and data frames

I want to add the same header values (from -1 to 1) as the first column in Julia. I have tried pretty tables but I could only add it as row header. In dataframes I want to replace the sequence numbers to the range (from -1 to 1) Pictures and code…
Hana
  • 101
  • 5
0
votes
1 answer

Python Telegram URL in Table

I want my Telegram bot to send a message that has a formatted table with links inside. I am using prettytable module as a basis to create a table. Here is what my table variable looks…
Bijan
  • 7,737
  • 18
  • 89
  • 149
0
votes
1 answer

Creating a table in python and printing to a PDF

I know some similar questions have been asked but none have been able to answer my question or maybe my python programming skills are not that great(they are not). Ultimately I'm trying to creating a table to look like the one below, all of the…
0
votes
0 answers

Creating Tables with PrettyTable Library - the columns are not alligend

I use a very simple code for creating a table using prettytable library. The columns are not aligned (see result below). Why it is happening?
0
votes
0 answers

Merging Tables using PrettyTable Module (Python3)

I'm trying to combine a couple of tables that I've already created into one large table output. Input: cnt = Counter() for ip in srcIP: cnt[ip] += 1 table1= PrettyTable(["SRC.IP", "Count"]) for ip, count in cnt.most_common(): …
Number23
  • 1
  • 1
0
votes
1 answer

CSV file to an array to a table? (Python 3.10.4)

I'm new to Python and doing some project based learning. I have a CSV file that I've put into an array but I'd like present it in PrettyTable Here's what I have so far: import csv import numpy as np with open('destiny.csv', 'r') as f: data =…
Mel B
  • 1
  • 1
0
votes
1 answer

Color doesn't show when running python script in cmd / batch file

I'm trying to print a table with colored text using prettytable. When I run it in VSCode it works. However if I then try to run it with Windows cmd no colors are shown relevant Python Code: ... #Colours green = '\033[92m' yellow = '\033[93m' red =…
Manticore
  • 1
  • 1
0
votes
2 answers

PrettyTable for loop is telling me TypeError: PrettyTable.add_row() takes 2 positional arguments but 8 were given

I have been trying to figure out what the issue is and can't seem to figure it out. valueRange = [j.value for i in copyRange for j in i] vrCounter = 0 vrStep = 7 x.field_names = ["Jurisdiction","SPOC-Name", "Lines of Business","Market Area",…
0
votes
1 answer

How to make field names in prettytable auto switch lines?

I am using prettytable to generate tables. But when the feild name is too long, it won't switch lines. The example code is like below: import prettytable x = prettytable.PrettyTable() x.max_table_width = 50 x.hrules = prettytable.ALL x.vrules =…
ToughMind
  • 987
  • 1
  • 10
  • 28
0
votes
1 answer

Trying to open a dictionary like txt file and print its contents into PrettyTable in Python

I'm trying to create a small Python script based on a dictionary with a key "name" and value "age" which should accept user input, write the dictionary to a .txt file and open then output the contents of the file into Pretty Table with columns…
Angelism
  • 23
  • 5
0
votes
2 answers

Parse ascii table header

So I need to parse this into dataframe or list: tmp = ['+--------------+-----------------------------------------+', '| Something to | Some header with subheader |', '| watch or +-----------------+-----------------------+', '| …
vovakirdan
  • 345
  • 3
  • 11
0
votes
1 answer

Parsing (reading) prettytable text tables

I couldn't find any information about reading ascii tables (prettytable-looking). I need to parse some tables that look like this: +--------+--------+-------------------+ | Planets …
vovakirdan
  • 345
  • 3
  • 11
0
votes
1 answer

How to make a Table in Python using PrettyTable Packet

I am trying to create a simple table using the PrettyTable Packet in Python 3. However, whenever I complete typing the samples, the sentence (SyntaxError: multiple statements found while compiling a single statement) always appear after I press…