Skip to content

Conversation

alistairewj
Copy link
Collaborator

Quick fix - passing an index object to columns causes an error (e.g. t1 = tableone(df, columns=df.columns)). Added a check if it's a pandas index data type since it's probably very common to pass it.

tableone.py Outdated
categorical = self._detect_categorical_columns(data[columns])
elif 'pandas.core.indexes' in str(type(categorical)):
categorical = categorical.get_values()
elif type(categorical) != list:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone specifies a single categorical variable as a string (e.g. categorical = 'ICU'), then I think we now ignore their selection and generate the list ourselves. Might be good to catch the string too?

@tompollard tompollard force-pushed the master branch 3 times, most recently from 9ff9874 to 1db34db Compare November 16, 2019 02:51
@tompollard tompollard force-pushed the master branch 3 times, most recently from 6f62620 to fabcd16 Compare May 6, 2020 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants