I've tried to use pandas and PrettyTable but neither of them helped me in my case.
Here is my case:
left_headers = ['Numbers', 'Animals', 'Names', 'Flowers']
data = [
[1, 2, 3, 4, 5, 6],
['dog', 'cat', 'rabbit', 'elephant', 'hyena', 'kangaroo'],
['short name', 'a very long name', '123', 'some text', 'different name', 'another name'],
['tulip', 'cactus', 'daffodil', 'hydrangea', 'geranium', 'rose']
]
Now I want it in this form:
Numbers 1 2 3 4 5 6
Animals dog cat rabbit elephant hyena kangaroo
Names short name a very long name 123 some text different name another name
Flowers tulip cactus daffodil hydrangea geranium rose
Data is separated by tabs not spaces. All beginning characters should be adjusted.
The main idea: headers are on left side. All data (and headers) are separated by some number of tabs. My problem is that I don't know how to predict how many tabs do I need to fit the data. I want to use as less tabs as possible to fit all data with minimal space but It should be at least one 'space' (like between "Numbers" and "1").
Edit: I did it with very ugly code. I added my answer.