Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect column widths #31

Closed
prjemian opened this issue Jul 23, 2019 · 3 comments · Fixed by #32
Closed

incorrect column widths #31

prjemian opened this issue Jul 23, 2019 · 3 comments · Fixed by #32
Assignees
Labels

Comments

@prjemian
Copy link
Owner

import pyRestTable
table = pyRestTable.Table()
table.labels = ['h', 'k', 'l', 'mu', 'omega', 'chi', 'phi', 'gamma', 'delta']
table.addRow([0, 1, 1, 0.0, 3.4824458166048444, 22.712897698011936, 0.0, 0.0, 13.799774663132288])
table.addRow([0.0, 8.0, 0.0, 0.0, 22.31594087562736, 89.13769999977886, 0.0, 0.0, 45.158571742842376])
table.addRow([0.0, 12.0, 1.0, 0.0, 34.963469180020944, 78.33265876350477, 0.0, 0.0, 71.80070421791422])
print(table)

This is the output:

= ==== === == ================== ================== === ===== ==================
h k    l   mu omega              chi                phi gamma delta             
= ==== === == ================== ================== === ===== ==================
0 1    1   0.0 3.4824458166048444 22.712897698011936 0.0 0.0   13.799774663132288
0.0 8.0  0.0 0.0 22.31594087562736  89.13769999977886  0.0 0.0   45.158571742842376
0.0 12.0 1.0 0.0 34.963469180020944 78.33265876350477  0.0 0.0   71.80070421791422 
= ==== === == ================== ================== === ===== ==================

Columns h and mu should be wider.

@prjemian prjemian added the bug label Jul 23, 2019
@prjemian prjemian self-assigned this Jul 23, 2019
@prjemian
Copy link
Owner Author

Should be this:

=== ==== === === ================== ================== === ===== ==================
h   k    l   mu  omega              chi                phi gamma delta             
=== ==== === === ================== ================== === ===== ==================
0   1    1   0.0 3.4824458166048444 22.712897698011936 0.0 0.0   13.799774663132288
0.0 8.0  0.0 0.0 22.31594087562736  89.13769999977886  0.0 0.0   45.158571742842376
0.0 12.0 1.0 0.0 34.963469180020944 78.33265876350477  0.0 0.0   71.80070421791422 
=== ==== === === ================== ================== === ===== ==================

@prjemian
Copy link
Owner Author

new unit test

prjemian added a commit that referenced this issue Jul 23, 2019
prjemian added a commit that referenced this issue Jul 23, 2019
prjemian added a commit that referenced this issue Jul 23, 2019
prjemian added a commit that referenced this issue Jul 23, 2019
prjemian added a commit that referenced this issue Jul 23, 2019
@prjemian
Copy link
Owner Author

prjemian commented Jul 23, 2019

final result (not so wide due to floating point truncation as str):

=== ==== === === ============= ============= === ===== =============
h   k    l   mu  omega         chi           phi gamma delta        
=== ==== === === ============= ============= === ===== =============
0   1    1   0.0 3.4824458166  22.712897698  0.0 0.0   13.7997746631
0.0 8.0  0.0 0.0 22.3159408756 89.1376999998 0.0 0.0   45.1585717428
0.0 12.0 1.0 0.0 34.96346918   78.3326587635 0.0 0.0   71.8007042179
=== ==== === === ============= ============= === ===== =============

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant