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

Ir-regular columns #16

Open
chfw opened this issue Mar 31, 2016 · 5 comments
Open

Ir-regular columns #16

chfw opened this issue Mar 31, 2016 · 5 comments

Comments

@chfw
Copy link
Member

chfw commented Mar 31, 2016

What's the impact of https://github.com/pyexcel/pyexcel-text/blob/master/tests/test_io.py#L85?

@jayvdb
Copy link
Contributor

jayvdb commented Mar 31, 2016

Well, the rst and html formats handle this differently, having a cell for the missing data, but most importantly the column should be recognised as having numerical alignment. i.e. this bug is impacting the other rows.

If it is an upstream bug, it should be reported (but given the lack of response on the PR I sent them...) and a workaround included in pyexcel-text so that our users can rely on numbers being aligned correctly, otherwise we need to document this oddity.

Also the JSON uses "Column 3": "" instead of omitting the cell or using "Column 3": null.

@jayvdb
Copy link
Contributor

jayvdb commented Apr 3, 2016

There are multiple problematic results here, which may have a similar fix.

When pyexcel is loading a dict, it replaces empty cells with "".

Empty cells in CVS files loaded with pyexcel-io are removed , due to pyexcel/pyexcel-io@00973b4da9 , and then pyexcel replaces the missing with "".

So the pyexcel-text column formatting problem is because the column contains numbers and empty strings, so it renders the column as strings.

Issues when loading a dict isnt a serious problem -- the caller can fix the data. However when loading a csv file, using pyexcel-io, the caller shouldnt be expected to know that they need to restore the missing cells.

So the serious problem here is that -text is not compatible with -io's csv loader.

One possible workaround is for pyexcel-text to replace "" cells with None, and see if tabulate ignores the None when determining the data type for the column.

@chfw
Copy link
Member Author

chfw commented Apr 3, 2016

regarding the workaround, looks like placing " "(one space) in https://github.com/pyexcel/pyexcel-text/blob/master/tests/test_io.py#L217 will get the position filled. '' or None does not help.

@jayvdb
Copy link
Contributor

jayvdb commented Apr 4, 2016

A single space may fill the column but it will not fix the alignment of a column containing numbers.

@chfw
Copy link
Member Author

chfw commented Apr 5, 2016

What would be the work around?

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

No branches or pull requests

2 participants