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.
7 odpowiedzi
+ 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**
+ 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")
+ 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.
+ 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).
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.
0
pandas dataframe.
0
yeah... i had to download and install 'em first to use