Skip to content

Commit

Permalink
Bugfix: DF column comparison
Browse files Browse the repository at this point in the history
In autoclean_cv, it’s sometimes not possible to perform `sorted()` on
the column name lists because they can be a mix of numbers and strings.
Instead, turn the column name lists into sets and perform the
comparison that way.
  • Loading branch information
rhiever committed Mar 2, 2016
1 parent e0fb1a7 commit 1bcc4d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datacleaner/datacleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def autoclean_cv(training_dataframe, testing_dataframe, drop_nans=False, copy=Fa
Cleaned testing data set
"""
if sorted(training_dataframe.columns.values) != sorted(testing_dataframe.columns.values):
if set(training_dataframe.columns.values) != set(testing_dataframe.columns.values):
raise ValueError('The training and testing DataFrames do not have the same columns. '
'Make sure that you are providing the same columns.')

Expand Down

0 comments on commit 1bcc4d7

Please sign in to comment.