back-end/utils/descriptive_analysis_summer.py
def data_frame_to_json(self, data_frame, analysis_file_name):
        """ Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file
            @param
                data_frame
                filename:   (str)   the name of the json file to be created
        """
        json_analysis_file_name = self.__path + '{}.json'.format(analysis_file_name)

        data_frame_list = list([])

        try:
            # break down every data frame row in tuple
            for row in data_frame.itertuples():
                # then keep the necessary stuff, the index timestamp and the accumulated value
                # row[0] is the datetime
                # row[1] is the number_of_attacks

                highcharts_timestamp = self.__high_charts_timestamp__(row[0])

                row_list = [highcharts_timestamp, row[1]]
                # append each list in a top list
                data_frame_list.append(row_list)

            # save list of lists in the file
            with open(json_analysis_file_name, 'w') as json_file:
                json.dump(data_frame_list, json_file, indent=4)
        except Exception as e:
            print("DescriptiveAnalysis > dataframe_to_json : Store in JSON file Error: ", e)
 Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file
            @param
                data_frame
                filename:   (str)   the name of the json file to be created
        
Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file
@param
data_frame
filename:   (str)   the name of the json file to be created
Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file @param data_frame filename : ( str ) the name of the json file to be created
def data_frame_to_json(self, data_frame, analysis_file_name):
        json_analysis_file_name = self.__path + '{}.json'.format(analysis_file_name)
        data_frame_list = list([])
        try:
            for row in data_frame.itertuples():
                highcharts_timestamp = self.__high_charts_timestamp__(row[0])
                row_list = [highcharts_timestamp, row[1]]
                data_frame_list.append(row_list)
            with open(json_analysis_file_name, 'w') as json_file:
                json.dump(data_frame_list, json_file, indent=4)
        except Exception as e:
            print("DescriptiveAnalysis > dataframe_to_json : Store in JSON file Error: ", e)
def data_frame_to_json ( self , data_frame , analysis_file_name ) : json_analysis_file_name = self . __path + '{}.json' . format ( analysis_file_name ) data_frame_list = list ( [ ] ) try : for row in data_frame . itertuples ( ) : highcharts_timestamp = self . __high_charts_timestamp__ ( row [ 0 ] ) row_list = [ highcharts_timestamp , row [ 1 ] ] data_frame_list . append ( row_list ) with open ( json_analysis_file_name , 'w' ) as json_file : json . dump ( data_frame_list , json_file , indent = 4 ) except Exception as e : print ( "DescriptiveAnalysis > dataframe_to_json : Store in JSON file Error: " , e )
Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file
@param
data_frame
filename:   (str)   the name of the json file to be created
Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file @param data_frame filename : ( str ) the name of the json file to be created
""" Given a data_frame creates a list of smaller lists that contain data frame pairs and stores them in a json file
            @param
                data_frame
                filename:   (str)   the name of the json file to be created
        """ # break down every data frame row in tuple
 # then keep the necessary stuff, the index timestamp and the accumulated value
 # row[0] is the datetime
 # row[1] is the number_of_attacks
 # append each list in a top list
 # save list of lists in the file

self
data_frame
analysis_file_name