From 98390d78dabf0248c4531288784b9c0c32aefa4e Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Mon, 17 Jul 2017 21:31:42 -0400 Subject: [PATCH] COMPAT: np.full not available in all versions, xref #16773 (#17000) --- pandas/core/sparse/frame.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/sparse/frame.py b/pandas/core/sparse/frame.py index e157ae16e71f9b..5fe96d70fc16f7 100644 --- a/pandas/core/sparse/frame.py +++ b/pandas/core/sparse/frame.py @@ -163,7 +163,9 @@ def _init_dict(self, data, index, columns, dtype=None): # TODO: figure out how to handle this case, all nan's? # add in any other columns we want to have (completeness) - nan_arr = sp_maker(np.full(len(index), np.nan)) + nan_arr = np.empty(len(index), dtype='float64') + nan_arr.fill(np.nan) + nan_arr = sp_maker(nan_arr) sdict.update((c, nan_arr) for c in columns if c not in sdict) return to_manager(sdict, columns, index)