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