iofunc/iofiles.py
def save(self, data, labels=None):
        """
        Save a np array into a csv file.
        ---------------------------------------------
        Parameters:
            data: raw data
            labels: Data names. Labels as a list.
        """
        if isinstance(data, np.ndarray):
            if data.ndim == 1:
                data = np.expand_dims(data, axis=1)
            try:
                f = open(self._comp_file, 'w')
            except IOError:
                print('Can not save file' + self._comp_file)
            else:
                if isinstance(labels, list):
                    labels = [str(item) for item in labels]
                    labels = ','.join(labels)
                    f.write(labels + '\n')
                for line in data:
                    line_str = [str(item) for item in line]
                    line_str = ','.join(line_str)
                    f.write(line_str + '\n')
                f.close()
        else:
            raise Exception('Input must be a numpy array.')

        Save a np array into a csv file.
        ---------------------------------------------
        Parameters:
            data: raw data
            labels: Data names. Labels as a list.
        
Save a np array into a csv file.
Save a np array into a csv file .
def save(self, data, labels=None):
        if isinstance(data, np.ndarray):
            if data.ndim == 1:
                data = np.expand_dims(data, axis=1)
            try:
                f = open(self._comp_file, 'w')
            except IOError:
                print('Can not save file' + self._comp_file)
            else:
                if isinstance(labels, list):
                    labels = [str(item) for item in labels]
                    labels = ','.join(labels)
                    f.write(labels + '\n')
                for line in data:
                    line_str = [str(item) for item in line]
                    line_str = ','.join(line_str)
                    f.write(line_str + '\n')
                f.close()
        else:
            raise Exception('Input must be a numpy array.')
def save ( self , data , labels = None ) : if isinstance ( data , np . ndarray ) : if data . ndim == 1 : data = np . expand_dims ( data , axis = 1 ) try : f = open ( self . _comp_file , 'w' ) except IOError : print ( 'Can not save file' + self . _comp_file ) else : if isinstance ( labels , list ) : labels = [ str ( item ) for item in labels ] labels = ',' . join ( labels ) f . write ( labels + '\n' ) for line in data : line_str = [ str ( item ) for item in line ] line_str = ',' . join ( line_str ) f . write ( line_str + '\n' ) f . close ( ) else : raise Exception ( 'Input must be a numpy array.' )
Save a np array into a csv file.
Save a np array into a csv file .
"""
        Save a np array into a csv file.
        ---------------------------------------------
        Parameters:
            data: raw data
            labels: Data names. Labels as a list.
        """
self
data
None
labels
Data names. Labels as a list.
Data names . Labels as a list .