From 228bd2a6c1be4d9250d4967b7bbb83f70cb7ec0e Mon Sep 17 00:00:00 2001 From: Kevin Bird Date: Thu, 10 May 2018 12:01:55 -0500 Subject: [PATCH] add convert_objects() to get_X get_X was taking a pandas Series and transposing it, but this made all the dtypes "Objects" instead of their actual dtypes. the convert_objects function appears to fix this issue. --- eli5/sklearn/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eli5/sklearn/utils.py b/eli5/sklearn/utils.py index 45ea6466..c22eca9f 100644 --- a/eli5/sklearn/utils.py +++ b/eli5/sklearn/utils.py @@ -226,7 +226,7 @@ def get_X(doc, vec=None, vectorized=False, to_dense=False): X = np.array([doc]) elif pandas_available and isinstance(doc, pd.Series): # Convert to a DataFrame with a single row - X = doc.to_frame().transpose() + X = doc.to_frame().transpose().convert_objects() else: X = doc else: