def homogenize(series_dict):
 index = None
 need_reindex = False
 for (_, series) in compat.iteritems(series_dict):
  if (not np.isnan(series.fill_value)):
   raise TypeError('this method is only valid with NaN fill values')
  if (index is None):
   index = series.sp_index
  elif (not series.sp_index.equals(index)):
   need_reindex = True
   index = index.intersect(series.sp_index)
 if need_reindex:
  output = {}
  for (name, series) in compat.iteritems(series_dict):
   if (not series.sp_index.equals(index)):
    series = series.sparse_reindex(index)
   output[name] = series
 else:
  output = series_dict
 return output

def homogenize ( series_dict ) : index = None need_reindex = False for ( _ , series ) in compat . iteritems ( series_dict ) : if ( not np . isnan ( series . fill_value ) ) : raise TypeError ( 'this method is only valid with NaN fill values' ) if ( index is None ) : index = series . sp_index elif ( not series . sp_index . equals ( index ) ) : need_reindex = True index = index . intersect ( series . sp_index ) if need_reindex : output = { } for ( name , series ) in compat . iteritems ( series_dict ) : if ( not series . sp_index . equals ( index ) ) : series = series . sparse_reindex ( index ) output [ name ] = series else : output = series_dict return output
conform a set of sparseseries to a common sparseindex corresponding to the locations where they all have data parameters series_dict : dict or dataframe notes using the dumbest algorithm i could think of .