(self, data_frame, part_of_iter=False)
Add a data frame into the buffer.

        Args:
              data_frame: a pandas data frame object to add to the buffer.
              part_of_iter: if it is expected that this function is called
                  as part of an iterator, or that many data frames may be
                  added to the importer set to True, defaults to False.

        Raises:
              ValueError: if the data frame does not contain the correct
                  columns for Timesketch upload.
Add a data frame into the buffer.
Add a data frame into the buffer .
def add_data_frame(self, data_frame, part_of_iter=False):
        """Add a data frame into the buffer.

        Args:
              data_frame: a pandas data frame object to add to the buffer.
              part_of_iter: if it is expected that this function is called
                  as part of an iterator, or that many data frames may be
                  added to the importer set to True, defaults to False.

        Raises:
              ValueError: if the data frame does not contain the correct
                  columns for Timesketch upload.
        """
        self._ready()

        if not isinstance(data_frame, pandas.DataFrame):
            raise TypeError('Entry object needs to be a DataFrame')

        size = data_frame.shape[0]

        if self._config_helper:
            data_type = ''
            if 'data_type' in data_frame:
                data_types = data_frame.data_type.unique()
                if len(data_types) == 1:
                    data_type = data_types[0]

            df_columns = list(data_frame.columns)
            self._config_helper.configure_streamer(
                self, data_type=data_type, columns=df_columns)

        data_frame_use = self._fix_data_frame(data_frame)

        if 'datetime' not in data_frame_use:
            raise ValueError(
                'Need a field called datetime in the data frame that is '
                'formatted according using this format string: '
                '%Y-%m-%dT%H:%M:%S%z. If that is not provided the data frame '
                'needs to have a column that has the word "time" in it, '
                'that can be used to convert to a datetime field.')

        if 'message' not in data_frame_use:
            raise ValueError(
                'Need a field called message in the data frame, use the '
                'formatting string to generate one automatically.')

        if 'timestamp_desc' not in data_frame_use:
            raise ValueError(
                'Need a field called timestamp_desc in the data frame.')

        if size <= self._threshold_entry:
            end_stream = not part_of_iter
            self._upload_data_frame(data_frame_use, end_stream=end_stream)
            return

        chunks = int(math.ceil(float(size) / self._threshold_entry))
        for index in range(0, chunks):
            chunk_start = index * self._threshold_entry
            data_chunk = data_frame_use[
                chunk_start:chunk_start + self._threshold_entry]
            end_stream = bool(index == chunks - 1)
            self._upload_data_frame(data_chunk, end_stream=end_stream)
def add_data_frame ( self , data_frame , part_of_iter = False ) : self . _ready ( ) if not isinstance ( data_frame , pandas . DataFrame ) : raise TypeError ( 'Entry object needs to be a DataFrame' ) size = data_frame . shape [ 0 ] if self . _config_helper : data_type = '' if 'data_type' in data_frame : data_types = data_frame . data_type . unique ( ) if len ( data_types ) == 1 : data_type = data_types [ 0 ] df_columns = list ( data_frame . columns ) self . _config_helper . configure_streamer ( self , data_type = data_type , columns = df_columns ) data_frame_use = self . _fix_data_frame ( data_frame ) if 'datetime' not in data_frame_use : raise ValueError ( 'Need a field called datetime in the data frame that is ' 'formatted according using this format string: ' '%Y-%m-%dT%H:%M:%S%z. If that is not provided the data frame ' 'needs to have a column that has the word "time" in it, ' 'that can be used to convert to a datetime field.' ) if 'message' not in data_frame_use : raise ValueError ( 'Need a field called message in the data frame, use the ' 'formatting string to generate one automatically.' ) if 'timestamp_desc' not in data_frame_use : raise ValueError ( 'Need a field called timestamp_desc in the data frame.' ) if size <= self . _threshold_entry : end_stream = not part_of_iter self . _upload_data_frame ( data_frame_use , end_stream = end_stream ) return chunks = int ( math . ceil ( float ( size ) / self . _threshold_entry ) ) for index in range ( 0 , chunks ) : chunk_start = index * self . _threshold_entry data_chunk = data_frame_use [ chunk_start : chunk_start + self . _threshold_entry ] end_stream = bool ( index == chunks - 1 ) self . _upload_data_frame ( data_chunk , end_stream = end_stream )