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
3
votes
1 answer

Table from PrettyTable to pdf

I created a table using PrettyTable. I would like to save the output as a .pdf file but the only thing I can do is save it as .txt. How to save it as .pdf file? I installed the FPDF library but I am stucked with this. # my table is saved as 'data'…
Marco
  • 37
  • 1
  • 7
3
votes
1 answer

Is there anyway to style elements based on a conditional using PrettyTable

Here is the code: from prettytable import PrettyTable import requests def market_table(): api = "https://api.coinmarketcap.com/v2/ticker/" raw_data = requests.get(api).json() data = raw_data['data'] table = PrettyTable() for…
wormyworm
  • 179
  • 8
3
votes
2 answers

Python- displaying frequent words in a table and skipping certain words

Currently I'm doing a frequency analysis on a text file that shows the top 100 commonly used words in the text file. Currently I'm using this code: from collections import Counter import re words = re.findall(r'\w+',…
Vin23
  • 257
  • 1
  • 4
  • 9
2
votes
0 answers

How to tell VS Code to import a library from an existing venv?

I was studying about Oriented Programming and just arrived in a topic of the course that uses the library 'prettytable' to show that is possible to make ASCII tables without so much effort. The problem is that I'm trying to import this library from…
Nystrom
  • 21
  • 1
2
votes
1 answer

Prettytable vrules and hrules to none

I have the following code which produces pretty table. What i would like to do is to remove the vrules or hrules. The code i have is not doing anything. Could you please advise why? Just to make sure, vrules is the vertical lines from prettytable…
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
2
votes
4 answers

How can i convert pandas.core.frame.DataFrame to a list?

This is the from my csv file. This is because i want to group all Header A that has "happy" value in Header C print(df.loc[df["Header C"] == "happy"]) and this is the output: Header A Header B Header…
2
votes
1 answer

Get information about files in a directory and print in a table

I'm stuck. I want to take a Windows directory that the user specifies, and list every file in that directory on a table with path, file name, file size, last modified time, and MD5 hash. For the life of me I can't figure out how to break it up in to…
Matt R
  • 21
  • 2
2
votes
1 answer

Why I cannot install prettytable in Anaconda?

Our homework requires us to install prettytable, but I tried many times and failed to install. Can anyone tell me how to do it? I used following ways: from prettytable import PrettyTable Error: No module named 'prettytable' import prettytable I…
Sandy
  • 359
  • 4
  • 14
2
votes
1 answer

Writing prettytable in output file in python

I am parsing through a textfile and extracting the information I need into a prettytable. However, I am unable to write the table out as one table it outputs as a single table for each item. My code for outputting the table: f = open("out2.txt",…
Kay Carosfeild
  • 91
  • 1
  • 1
  • 12
2
votes
1 answer

Python prettytable no module, but module is there

I'm trying to run DrQa form facebook research, available at https://github.com/facebookresearch/DrQA. One of the requirements is prettytable. I had problems installing it, and followed Can't install prettytable: pip3 install…
Thomas Hubregtsen
  • 449
  • 1
  • 5
  • 22
2
votes
1 answer

Using PrettyTable, Can I write a function that will take inputs and add them into a table so I don't have to continuously repeat myself?

I made a multiplication table, but I had to manually type out the code to add to my table. I want to write a loop that does it for me so the multiplication table can go on as long as I tell it too. Right now its limited to how many times i'm willing…
Vildjharta
  • 55
  • 2
  • 11
2
votes
4 answers

How to add new rows to already printed table in console?

My script needs to print a table while it is crunching some numbers. Its total run time is several hours, and I need it to add more and more rows to the printed table while it is running. I am trying to use PrettyTable, but I am open to other…
sprogissd
  • 2,755
  • 5
  • 24
  • 45
2
votes
0 answers

Using Pretty Table In Python to copy row from a table and write it into a csv file

I'm currently using pretty table for a Barbershop P.O.S implementation where the program needs to generate reports that an admin user can view. The reports are copied line by line from a csv(converted into a pretty table) each time a user logs that…
mabishi
  • 115
  • 1
  • 1
  • 8
2
votes
1 answer

python 3 PrettyTable

How can I get my output in the table? from prettytable import PrettyTable import sqlite3 x = PrettyTable(["URL"]) x.padding_width = 1 con = sqlite3.connect('C:\\Users\\joey\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History') cursor =…
joey
  • 241
  • 1
  • 4
  • 16
1
vote
1 answer

Removing the column headings off my Prettytable table

My project is to code a program that mimics a simple percolation process. When I run my program my output is a table with column headings as well. How do I remove this? I only need my random numbers to appear. import random from prettytable import…
1
2
3
10 11