diff --git a/pyproject.toml b/pyproject.toml index 5ecabbc..6522b23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "tableone" -version = "0.9.5" +version = "0.9.6.dev1" authors = [ { name="Tom Pollard", email="tpollard@mit.edu" }, { name="Alistair Johnson" }, diff --git a/tableone/tables.py b/tableone/tables.py index 2ec1974..f10fa04 100644 --- a/tableone/tables.py +++ b/tableone/tables.py @@ -442,7 +442,7 @@ def create_cont_table(self, try: table = table.join(nulltable) # if columns form a CategoricalIndex, need to convert to string first - except TypeError: + except (pd.errors.InvalidIndexError, TypeError): table.columns = table.columns.astype(str) table = table.join(nulltable) @@ -502,7 +502,7 @@ def create_cat_table(self, try: table = table.join(isnull) # if columns form a CategoricalIndex, need to convert to string first - except TypeError: + except (pd.errors.InvalidIndexError, TypeError): table.columns = table.columns.astype(str) table = table.join(isnull)