From 9bfd725e4eb13bc24074542e53522085bea6c8a3 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Mon, 17 Jul 2017 19:32:20 -0400 Subject: [PATCH] COMPAT: np.full not available in all versions, xref #16773 --- 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 e157ae16e71f9..5fe96d70fc16f 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)