| 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 | |
| 42 | plgs = [Count, Frequency] |