@@ -101,7 +101,7 @@ def __init__(self, data=None, index=None, columns=None,
101
101
mgr = self ._init_mgr (
102
102
data , axes = dict (index = index , columns = columns ), dtype = dtype , copy = copy )
103
103
elif data is None :
104
- data = {}
104
+ data = DataFrame ()
105
105
106
106
if index is None :
107
107
index = Index ([])
@@ -116,7 +116,7 @@ def __init__(self, data=None, index=None, columns=None,
116
116
index = index ,
117
117
kind = self ._default_kind ,
118
118
fill_value = self ._default_fill_value )
119
- mgr = dict_to_manager (data , columns , index )
119
+ mgr = df_to_manager (data , columns , index )
120
120
if dtype is not None :
121
121
mgr = mgr .astype (dtype )
122
122
@@ -156,7 +156,7 @@ def _init_dict(self, data, index, columns, dtype=None):
156
156
kind = self ._default_kind ,
157
157
fill_value = self ._default_fill_value ,
158
158
copy = True )
159
- sdict = {}
159
+ sdict = DataFrame ()
160
160
for k , v in compat .iteritems (data ):
161
161
if isinstance (v , Series ):
162
162
# Force alignment, no copy necessary
@@ -182,7 +182,7 @@ def _init_dict(self, data, index, columns, dtype=None):
182
182
if c not in sdict :
183
183
sdict [c ] = sp_maker (nan_vec )
184
184
185
- return dict_to_manager (sdict , columns , index )
185
+ return df_to_manager (sdict , columns , index )
186
186
187
187
def _init_matrix (self , data , index , columns , dtype = None ):
188
188
data = _prep_ndarray (data , copy = False )
@@ -229,12 +229,12 @@ def _unpickle_sparse_frame_compat(self, state):
229
229
else :
230
230
index = idx
231
231
232
- series_dict = {}
232
+ series_dict = DataFrame ()
233
233
for col , (sp_index , sp_values ) in compat .iteritems (series ):
234
234
series_dict [col ] = SparseSeries (sp_values , sparse_index = sp_index ,
235
235
fill_value = fv )
236
236
237
- self ._data = dict_to_manager (series_dict , columns , index )
237
+ self ._data = df_to_manager (series_dict , columns , index )
238
238
self ._default_fill_value = fv
239
239
self ._default_kind = kind
240
240
@@ -738,13 +738,13 @@ def applymap(self, func):
738
738
"""
739
739
return self .apply (lambda x : lmap (func , x ))
740
740
741
- def dict_to_manager ( sdict , columns , index ):
742
- """ create and return the block manager from a dict of series, columns, index """
741
+ def df_to_manager ( sdf , columns , index ):
742
+ """ create and return the block manager from a dataframe of series, columns, index """
743
743
744
744
# from BlockManager perspective
745
745
axes = [_ensure_index (columns ), _ensure_index (index )]
746
746
747
- return create_block_manager_from_arrays ([sdict [c ] for c in columns ], columns , axes )
747
+ return create_block_manager_from_arrays ([sdf [c ] for c in columns ], columns , axes )
748
748
749
749
750
750
def stack_sparse_frame (frame ):
0 commit comments