How can i present the data in a tabular form in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i present the data in a tabular form in python?

I tried using texttable but it doesn't show up correctly. the alignment is not correct of the data in the table.

11th Jan 2018, 10:10 PM
Arjun Saini
Arjun Saini - avatar
7 Answers
+ 2
Some visual alignment options with print(...): # help print( help(''.ljust) ) "Hi".ljust(5,"*") "Hi".rjust(5,"*") '{:<15}'.format('left') '[{:>15}]'.format('align right') '|{:^15}|'.format('center') '{:*^10}'.format('center') Output: Hi*** ***Hi left (+11 spaces) [ align right] | center | **center**
11th Jan 2018, 10:35 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
If you mean horizontal tabs for data (display alignment is not important), you can do something like this: list = ["a", "b", "c"] print(*list, sep="\t")
11th Jan 2018, 10:37 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
You can post a link to a CodePlayground code if you want people to look at it. I don't see any public codes.
11th Jan 2018, 10:42 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
As far as I can tell, neither 'pandas' nor 'texttable' are available imports on SoloLearn (if I'm missing something feel free to let me know).
12th Jan 2018, 3:10 AM
Kirk Schafer
Kirk Schafer - avatar
0
appreciate that ... but why ain't that texttable working?... its actually pretty cool, you should check it out .Does most of the work itself.
11th Jan 2018, 10:40 PM
Arjun Saini
Arjun Saini - avatar
0
pandas dataframe.
12th Jan 2018, 1:40 AM
Daniel Sanchez
Daniel Sanchez - avatar
0
yeah... i had to download and install 'em first to use
12th Jan 2018, 3:54 AM
Arjun Saini
Arjun Saini - avatar