MCPcopy Create free account
hub / github.com/Image-Py/imagepy / run

Method run

imagepy/menus/Table/Statistic/frequency_plgs.py:31–40  ·  view source on GitHub ↗
(self, tps, snap, data, para=None)

Source from the content-addressed store, hash-verified

29 (bool, 'weight', 'count weight')]
30
31 def run(self, tps, snap, data, para=None):
32 rg = None if para['auto'] else (para['min'], para['max'])
33 for i in para['cn']:
34 hist, bins = np.histogram(data[i], para['bins'], rg)
35 vs = {'bins':bins[:-1]}
36 if para['count']:vs['count'] = hist
37 if para['fre']:vs['frequency'] = hist/hist.sum()
38 if para['weight']:vs['weight'] = np.histogram(data[i], bins, rg, weights=data[i])[0]
39 df = pd.DataFrame(vs, columns = [i for i in ['bins', 'count', 'frequency', 'weight'] if i in vs])
40 IPy.show_table(df, '%s-frequency'%i)
41
42plgs = [Count, Frequency]

Callers

nothing calls this directly

Calls 1

histogramMethod · 0.80

Tested by

no test coverage detected