best-practice-and-impact / gptables

Good Practice Tables - an XlsxWriter wrapper to write consistently formatted statistical tables to Excel.
http://gptables.rtfd.io
Other
35 stars 4 forks source link

Note references in index column #197

Closed rowanhemsi closed 3 weeks ago

rowanhemsi commented 1 year ago

Is your feature request related to a problem? Please describe. Referencing notes in the index column of data tables results in an incorrect order for the notes table, including extra blank rows.

Describe the solution you'd like I would like to be able to reference notes in the index column of data tables using the $$reference$$ system used elsewhere in the workbook.

Describe alternatives you've considered The guidance states that notes should be avoided in data cells for reasons of usability and machine readability. Does this include index columns? If so, this feature should not be added.

Additional context Example usage:

column_heading var_1
Inside shop x
Street x
Outside shop x
In public entertainment[note1] x

Is note 1 allowed to be referenced where It currently is or should it sit at the column heading?

rowanhemsi commented 1 year ago

Seeking clarity regarding good practice guidance

rowanhemsi commented 1 year ago

Analysis Function team has confirmed that note references are acceptable in "row labels" - table columns that would be marked as indices in a GPTable. The example table above can be recreated using the existing package with the code below. Discussing exact usage with issue reporters.

import pandas as pd
import gptables as gpt

table = pd.DataFrame({
    "column_heading": [
        "Inside shop",
        "Street",
        "Outside shop",
        "In public entertainment$$ref1$$"
    ],
    "var_1": ["x", "x", "x", "x"],
})

gptable = gpt.GPTable(
    table=table,
    table_name="notes_test",
    title="Notes test",
)

notes_table = pd.DataFrame({
    "Note reference": ["ref1"],
    "Note text": ["some text"],
})

gpt.write_workbook(
    filename="notes_test.xlsx",
    sheets={"notes_test": gptable},
    notes_table=notes_table,
)
rowanhemsi commented 3 weeks ago

Closing as no further work required at this time