#NEWLINE# @ staticmethod #NEWLINE# def load( filename , network = None ) : #NEWLINE# #INDENT# "\n        Opens a 'csv' file, reads in the data, and adds it to the **Network**\n\n        Parameters\n        ----------\n        filename : string (optional)\n            The name of the file containing the data to import.  The formatting\n            of this file is outlined below.\n\n        Returns\n        -------\n        If no Network object is supplied then one will be created and returned.\n\n        " #NEWLINE# net = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# with _read_file ( filename = filename , ext = 'csv' ) as f : #NEWLINE# #INDENT# a = _pd . read_table ( filepath_or_buffer = f , sep = ',' , skipinitialspace = True , index_col = False , true_values = [ 'T' , 't' , 'True' , 'true' , 'TRUE' ] , false_values = [ 'F' , 'f' , 'False' , 'false' , 'FALSE' ] ) #NEWLINE# #UNINDENT# for item in a . keys ( ) : #NEWLINE# #INDENT# element = item . split ( '.' ) [ 0 ] #NEWLINE# prop = item . split ( '.' , maxsplit = 1 ) [ 1 ] #NEWLINE# data = _sp . array ( a [ item ] . dropna ( ) ) #NEWLINE# if ( type ( data [ 0 ] ) is str ) : #NEWLINE# #INDENT# N = _sp . shape ( data ) [ 0 ] #NEWLINE# if ( '.' in data [ 0 ] . split ( ' ' ) [ 0 ] ) : #NEWLINE# #INDENT# dtype = float #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dtype = int #NEWLINE# #UNINDENT# temp = _sp . empty ( _sp . shape ( data ) , dtype = object ) #NEWLINE# for row in range ( N ) : #NEWLINE# #INDENT# temp [ row ] = _sp . fromstring ( data [ row ] , sep = ' ' , dtype = dtype ) #NEWLINE# #UNINDENT# data = _sp . vstack ( temp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dtype = type ( data [ 0 ] ) #NEWLINE# #UNINDENT# net [ ( ( element + '.' ) + prop ) ] = data . astype ( dtype ) #NEWLINE# #UNINDENT# if ( network is None ) : #NEWLINE# #INDENT# network = OpenPNM . Network . GenericNetwork ( ) #NEWLINE# #UNINDENT# network = _update_network ( network = network , net = net ) #NEWLINE# return network