(self, step)
Output useful information to stdout and the log file if debugging is required.
        :step: Print the corresponding step in the log
Output useful information to stdout and the log file if debugging is required.
        :step: Print the corresponding step in the log
Output useful information to stdout and the log file if debugging is required . : step : Print the corresponding step in the log
def _print_log(self, step):
        """
        Output useful information to stdout and the log file if debugging is required.
        :step: Print the corresponding step in the log
        """
        
        if step == 1:
            # Output log header
            sys.stdout.write("\nHDBSCANForQlik Log: {0} \n\n".format(time.ctime(time.time())))
            with open(self.logfile,'w') as f:
                f.write("HDBSCANForQlik Log: {0} \n\n".format(time.ctime(time.time())))
        
        elif step == 2:
            # Output the request and input data frames to the terminal
            sys.stdout.write("Key word arguments: {0}\n\n".format(self.kwargs))
            sys.stdout.write("HDBSCAN parameters: {0}\n\n".format(self.hdbscan_kwargs))
            if self.scaler == "none":
                sys.stdout.write("No scaling applied\n\n")
            else:
                sys.stdout.write("{0} scaler parameters: {1}\n\n".format(self.scaler.capitalize(), self.scaler_kwargs))
            sys.stdout.write("REQUEST DATA FRAME: {0} rows x cols\n\n".format(self.request_df.shape))
            sys.stdout.write("{0} \n\n".format(self.request_df.to_string()))
            if len(self.NaN_df) > 0:
                sys.stdout.write("REQUEST NULL VALUES DATA FRAME: {0} rows x cols\n\n".format(self.NaN_df.shape))
                sys.stdout.write("{0} \n\n".format(self.NaN_df.to_string()))
            sys.stdout.write("INPUT DATA FRAME: {0} rows x cols\n\n".format(self.input_df.shape))
            sys.stdout.write("{0} \n\n".format(self.input_df.to_string()))
                        
            # Output the request and input data frames to the log file 
            with open(self.logfile,'a') as f:
                f.write("Key word arguments: {0}\n\n".format(self.kwargs))
                f.write("HDBSCAN parameters: {0}\n\n".format(self.hdbscan_kwargs))
                if self.scaler == "none":
                    f.write("No scaling applied\n\n")
                else:
                    f.write("{0} scaler parameters: {1}\n\n".format(self.scaler.capitalize(), self.scaler_kwargs))
                f.write("REQUEST DATA FRAME: {0} rows x cols\n\n".format(self.request_df.shape))
                f.write("{0} \n\n".format(self.request_df.to_string()))
                if len(self.NaN_df) > 0:
                    f.write("REQUEST NULL VALUES DATA FRAME: {0} rows x cols\n\n".format(self.NaN_df.shape))
                    f.write("{0} \n\n".format(self.NaN_df.to_string()))
                f.write("INPUT DATA FRAME: {0} rows x cols\n\n".format(self.input_df.shape))
                f.write("{0} \n\n".format(self.input_df.to_string()))
        
        elif step == 3:         
            # Print the output series to the terminal
            sys.stdout.write("\nCLUSTERING RESULTS: {0} rows x cols\n\n".format(self.response.shape))
            sys.stdout.write("{0} \n\n".format(self.response.to_string()))
            
            # Write the output data frame and returned series to the log file
            with open(self.logfile,'a') as f:
                f.write("\nCLUSTERING RESULTS: {0} rows x cols\n\n".format(self.response.shape))
                f.write("{0} \n\n".format(self.response.to_string()))
        
        elif step == 4:
            # Print the table description if the call was made from the load script
            sys.stdout.write("\nTABLE DESCRIPTION SENT TO QLIK:\n\n{0} \n\n".format(self.table))
            
            # Write the table description to the log file
            with open(self.logfile,'a') as f:
                f.write("\nTABLE DESCRIPTION SENT TO QLIK:\n\n{0} \n\n".format(self.table))
def _print_log ( self , step ) : if step == 1 : # Output log header sys . stdout . write ( "\nHDBSCANForQlik Log: {0} \n\n" . format ( time . ctime ( time . time ( ) ) ) ) with open ( self . logfile , 'w' ) as f : f . write ( "HDBSCANForQlik Log: {0} \n\n" . format ( time . ctime ( time . time ( ) ) ) ) elif step == 2 : # Output the request and input data frames to the terminal sys . stdout . write ( "Key word arguments: {0}\n\n" . format ( self . kwargs ) ) sys . stdout . write ( "HDBSCAN parameters: {0}\n\n" . format ( self . hdbscan_kwargs ) ) if self . scaler == "none" : sys . stdout . write ( "No scaling applied\n\n" ) else : sys . stdout . write ( "{0} scaler parameters: {1}\n\n" . format ( self . scaler . capitalize ( ) , self . scaler_kwargs ) ) sys . stdout . write ( "REQUEST DATA FRAME: {0} rows x cols\n\n" . format ( self . request_df . shape ) ) sys . stdout . write ( "{0} \n\n" . format ( self . request_df . to_string ( ) ) ) if len ( self . NaN_df ) > 0 : sys . stdout . write ( "REQUEST NULL VALUES DATA FRAME: {0} rows x cols\n\n" . format ( self . NaN_df . shape ) ) sys . stdout . write ( "{0} \n\n" . format ( self . NaN_df . to_string ( ) ) ) sys . stdout . write ( "INPUT DATA FRAME: {0} rows x cols\n\n" . format ( self . input_df . shape ) ) sys . stdout . write ( "{0} \n\n" . format ( self . input_df . to_string ( ) ) ) # Output the request and input data frames to the log file  with open ( self . logfile , 'a' ) as f : f . write ( "Key word arguments: {0}\n\n" . format ( self . kwargs ) ) f . write ( "HDBSCAN parameters: {0}\n\n" . format ( self . hdbscan_kwargs ) ) if self . scaler == "none" : f . write ( "No scaling applied\n\n" ) else : f . write ( "{0} scaler parameters: {1}\n\n" . format ( self . scaler . capitalize ( ) , self . scaler_kwargs ) ) f . write ( "REQUEST DATA FRAME: {0} rows x cols\n\n" . format ( self . request_df . shape ) ) f . write ( "{0} \n\n" . format ( self . request_df . to_string ( ) ) ) if len ( self . NaN_df ) > 0 : f . write ( "REQUEST NULL VALUES DATA FRAME: {0} rows x cols\n\n" . format ( self . NaN_df . shape ) ) f . write ( "{0} \n\n" . format ( self . NaN_df . to_string ( ) ) ) f . write ( "INPUT DATA FRAME: {0} rows x cols\n\n" . format ( self . input_df . shape ) ) f . write ( "{0} \n\n" . format ( self . input_df . to_string ( ) ) ) elif step == 3 : # Print the output series to the terminal sys . stdout . write ( "\nCLUSTERING RESULTS: {0} rows x cols\n\n" . format ( self . response . shape ) ) sys . stdout . write ( "{0} \n\n" . format ( self . response . to_string ( ) ) ) # Write the output data frame and returned series to the log file with open ( self . logfile , 'a' ) as f : f . write ( "\nCLUSTERING RESULTS: {0} rows x cols\n\n" . format ( self . response . shape ) ) f . write ( "{0} \n\n" . format ( self . response . to_string ( ) ) ) elif step == 4 : # Print the table description if the call was made from the load script sys . stdout . write ( "\nTABLE DESCRIPTION SENT TO QLIK:\n\n{0} \n\n" . format ( self . table ) ) # Write the table description to the log file with open ( self . logfile , 'a' ) as f : f . write ( "\nTABLE DESCRIPTION SENT TO QLIK:\n\n{0} \n\n" . format ( self . table ) )