#NEWLINE# def homogenize( series_dict ) : #NEWLINE# #INDENT# '\n    Conform a set of SparseSeries (with NaN fill_value) to a common SparseIndex\n    corresponding to the locations where they all have data\n\n    Parameters\n    ----------\n    series_dict : dict or DataFrame\n\n    Notes\n    -----\n    Using the dumbest algorithm I could think of. Should put some more thought\n    into this\n\n    Returns\n    -------\n    homogenized : dict of SparseSeries\n    ' #NEWLINE# index = None #NEWLINE# need_reindex = False #NEWLINE# for ( _ , series ) in compat . iteritems ( series_dict ) : #NEWLINE# #INDENT# if ( not np . isnan ( series . fill_value ) ) : #NEWLINE# #INDENT# raise TypeError ( 'this method is only valid with NaN fill values' ) #NEWLINE# #UNINDENT# if ( index is None ) : #NEWLINE# #INDENT# index = series . sp_index #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not series . sp_index . equals ( index ) ) : #NEWLINE# #INDENT# need_reindex = True #NEWLINE# index = index . intersect ( series . sp_index ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if need_reindex : #NEWLINE# #INDENT# output = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( name , series ) in compat . iteritems ( series_dict ) : #NEWLINE# #INDENT# if ( not series . sp_index . equals ( series ) ) : #NEWLINE# #INDENT# series = series . sparse_reindex ( index ) #NEWLINE# #UNINDENT# output [ name ] = series #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# output = series_dict #NEWLINE# #UNINDENT# return output