Skip to content

Commit

Permalink
remove empty column
Browse files Browse the repository at this point in the history
  • Loading branch information
tompollard committed Jan 29, 2018
1 parent 8a84244 commit c411e7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions tableone.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ def _create_tableone(self,data):
dupe_columns.append('ptest')
table[dupe_columns] = table[dupe_columns].mask(dupe_mask).fillna('')

# remove empty column added above
table.drop([''], axis=1, inplace=True)

# remove isnull column if not needed
if not self.isnull:
table.drop('isnull',axis=1,inplace=True)
Expand Down
7 changes: 3 additions & 4 deletions test_tableone.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,11 @@ def test_sequence_of_cont_table(self):
categorical = categorical, groupby = groupby, isnull = False)

# n and weight rows are already ordered, so sorting should not alter the order
assert (t.tableone.loc['n'].values[0][1:5].astype(float) == \
sorted(t.tableone.loc['n'].values[0][1:5].astype(float))).any()
assert (t.tableone.loc['age'].values[0][1:5] == \
assert (t.tableone.loc['n'].values[0].astype(float) == \
sorted(t.tableone.loc['n'].values[0].astype(float))).any()
assert (t.tableone.loc['age'].values[0] == \
['0.50 (0.71)', '3.50 (1.29)', '8.50 (1.87)', '15.50 (2.45)']).any()


@with_setup(setup, teardown)
def test_categorical_cell_count(self):
"""
Expand Down

0 comments on commit c411e7b

Please sign in to comment.