Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/api/gptable.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ you need.

## Additional formatting

In some cases you may want to apply one-off formatting on specific rows, columns or cells of the data.
In some cases you may want to apply one-off formatting on specific rows, columns or cells of the data. The formatting options include fonts, colors, patterns, borders, alignment and number formatting.
As mentioned above, this formatting should not be used to represent data or important information.

#### NOTE
Columns are automatically aligned based on the [spreadsheet accessibility guidance](https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/). This includes left alignment
of text outside a table, and row labels inside tables, as well as right alignment of data.

Bespoke formatting can be applied to an individual `GPTable` via the `additional_formatting` parameter,
when creating a `GPTable` instance. This parameter takes a list of dictionaries, where each dictionary
defines formatting for one or more rows, columns or cells.
Expand Down
6 changes: 5 additions & 1 deletion gptables/core/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,11 @@ def _apply_column_alignments(self, data_table, formats_table, index_columns):
value=np.nan,
).infer_objects(copy=False)

data_table_copy = data_table_copy.convert_dtypes()
for col in data_table_copy.columns:
try:
data_table_copy[col] = pd.to_numeric(data_table_copy[col])
except Exception:
pass

column_types = data_table_copy.dtypes

Expand Down
Loading