Skip to content
Merged
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
11 changes: 6 additions & 5 deletions gptables/core/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def _write_table_elements(self, pos, gptable, auto_width):

# Create formats array
# pandas.DataFrame did NOT want to hold dictionaries, so be wary
formats = pd.DataFrame().reindex_like(data)
formats = pd.DataFrame().reindex_like(data).astype(object)
dict_row = [{} for n in range(formats.shape[1])]
for row in range(formats.shape[0]):
dict_row = [{} for n in range(formats.shape[1])]
Expand Down Expand Up @@ -564,10 +564,11 @@ def _apply_column_alignments(self, data_table, formats_table, index_columns):
# look for shorthand notation, usually a few letters in square brackets
# will also find note markers eg [Note 1]
# Using np.nan instead on None for backwards compatibility with pandas <=1.4
data_table_copy = data_table.replace(
regex=r"\[[\w\s]+\]",
value=np.nan,
)
with pd.option_context("future.no_silent_downcasting", True):
data_table_copy = data_table.replace(
regex=r"\[[\w\s]+\]",
value=np.nan,
).infer_objects(copy=False)

data_table_copy = data_table_copy.convert_dtypes()

Expand Down