Skip to content

Commit cc906f6

Browse files
committed
Merge pull request #33 from tp199911/patch-3
non-overriding solution for py2/3 intercompatibility
2 parents d30fc50 + c4b7089 commit cc906f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn_pandas/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from sklearn import grid_search
88
import sys
99

10-
if sys.version_info >= (3, 0):
11-
basestring = str
10+
# load in the correct stringtype: str for py3, basestring for py2
11+
string_types = str if sys.version_info >= (3, 0) else basestring
1212

1313

1414
def cross_val_score(model, X, *args, **kwargs):
@@ -94,7 +94,7 @@ def _get_col_subset(self, X, cols):
9494
Returns a numpy array with the data from the selected columns
9595
"""
9696
return_vector = False
97-
if isinstance(cols, basestring):
97+
if isinstance(cols, string_types):
9898
return_vector = True
9999
cols = [cols]
100100

0 commit comments

Comments
 (0)