示例#1
0
def histogram(x, data, color='red', bins=20, title=None, dropna=False):
    '''Helper function to create a distribution histogram
    for `npv.simulate`
    '''

    if dropna is True:
        data.dropna(inplace=True)

    ast.hist(data, data.columns[0], bins=bins)
示例#2
0
    def hist(self, bins=5):

        '''HISTOGRAM PLOT VISUALIZATION'''

        ast.hist(self.df, 'ad_total_twh', bins=bins, x_limit=None,
                 title='Online Advertising',
                 sub_title='Energy in TWh')

        ast.hist(self.df, 'total_twh', bins=bins, x_limit=None,
                 title='Total Infrastructure',                 
                 sub_title='Energy in TWh')
示例#3
0
def hist_full(df):

    ast.hist(data=df,
             x='A',
             bins=40,
             dropna=True,
             vertical=True,
             palette='colorblind',
             style='fivethirtyeight',
             dpi=240,
             title='This is a title',
             sub_title='And this a subtitle',
             x_label='this is x label',
             y_label='and this y',
             legend=False,
             x_scale='log',
             x_limit=24)
示例#4
0
def test_simple_minimal(df):

    ast.corr(df)
    ast.kde(data=df, x='A')
    ast.hist(df, x='A')
    ast.pie(df, x='other')
    ast.swarm(df, x='A', y='B', hue='even')
    ast.scat(df, x='A', y='B', hue='even')
    ast.line(df, x='A')
    ast.grid(df, x='A', y='B', col='even')
    ast.box(df, x='odd', y='A', hue='even')
    ast.violin(df, x='odd', y='A', hue='even')
    ast.strip(df, x='odd', y='B', hue='even')
    ast.count(df, x='cats')
    ast.bargrid(df, x='even', y='B', hue='other', col='odd')
    ast.overlap(df, x='A', y='B', label_col='other')
    ast.multikde(df, x='A', label_col='even')
    ast.compare(df, x='A', y=['B', 'C'], label_col='other')
    ast.multicount(df, x='even', hue='odd', col='other')
示例#5
0
    def plot_hist(self, metric='val_acc', bins=10):
        '''A histogram for a given metric

        NOTE: remember to invoke %matplotlib inline if in notebook

        metric :: the metric to correlate against
        bins :: number of bins to use in histogram

        '''

        return hist(self.data, metric, bins=bins)
示例#6
0
    def plot_hist(self, metric, bins=10):
        '''A histogram for a given metric

        NOTE: remember to invoke %matplotlib inline if in notebook

        metric | str | Column label for the metric to correlate with
        bins | int | Number of bins to use in histogram

        '''
        try:
            import astetik as ast
            return ast.hist(self.data, metric, bins=bins)
        except RuntimeError:
            print('Matplotlib Runtime Error. Plots will not work.')