def __init__(self, flowbackend, databackend): AnalysisBase.__init__(self, flowbackend, databackend) self.hostInfoDB = hostinfodb.HostInfoDB() self.hiCollectionName = common.HOST_INFORMATION_COLLECTION self.analysisResultDict = { "IP" : ("NUMBER(10)", "PRIMARY"), "LASTSEEN" : ("NUMBER(10)", None), "LASTINFOCHECK" : ("NUMBER(10)", None) } self.dataBackend.prepareCollection(self.hiCollectionName, self.analysisResultDict)
def __init__(self, flowbackend, databackend): AnalysisBase.__init__(self, flowbackend, databackend) self.hostInfoDB = hostinfodb.HostInfoDB() self.hiCollectionName = common.HOST_INFORMATION_COLLECTION self.analysisResultDict = { "IP": ("NUMBER(10)", "PRIMARY"), "LASTSEEN": ("NUMBER(10)", None), "LASTINFOCHECK": ("NUMBER(10)", None) } self.dataBackend.prepareCollection(self.hiCollectionName, self.analysisResultDict)
def __init__(self, flowbackend, databackend): AnalysisBase.__init__(self, flowbackend, databackend)
"""Plotting notebook for publication frequency per month.""" from analysis_base import AnalysisBase import numpy as np import pandas as pd import matplotlib.pyplot as plt data = AnalysisBase() bbc = data.bbc cnn = data.cnn nyt = data.nyt reuters = data.reuters bbc_per_month = bbc.groupby([pd.Grouper(key='published', freq='M')])['content'].count() bbc_per_month = bbc_per_month.reindex(data.raw_index_months) bbc_per_month[np.isnan(bbc_per_month)] = 0 cnn_per_month = cnn.groupby([pd.Grouper(key='published', freq='M')])['content'].count() cnn_per_month = cnn_per_month.reindex(data.raw_index_months) cnn_per_month[np.isnan(cnn_per_month)] = 0 nyt_per_month = nyt.groupby([pd.Grouper(key='published', freq='M')])['content'].count() nyt_per_month = nyt_per_month.reindex(data.raw_index_months) nyt_per_month[np.isnan(nyt_per_month)] = 0 reuters_per_month = reuters.groupby([pd.Grouper(key='published', freq='M')])['content'].count() reuters_per_month = reuters_per_month.reindex(data.raw_index_months)