Print the mean, min, max, median, std, and size of a numpy array Parameters: val (bool) -- if print the values of the numpy array shp (bool) -- if print the shape of the numpy array
(x, val=True, shp=False)
| 102 | |
| 103 | |
| 104 | def print_numpy(x, val=True, shp=False): |
| 105 | """Print the mean, min, max, median, std, and size of a numpy array |
| 106 | |
| 107 | Parameters: |
| 108 | val (bool) -- if print the values of the numpy array |
| 109 | shp (bool) -- if print the shape of the numpy array |
| 110 | """ |
| 111 | x = x.astype(np.float64) |
| 112 | if shp: |
| 113 | print('shape,', x.shape) |
| 114 | if val: |
| 115 | x = x.flatten() |
| 116 | print('mean = %3.3f, min = %3.3f, max = %3.3f, median = %3.3f, std=%3.3f' % ( |
| 117 | np.mean(x), np.min(x), np.max(x), np.median(x), np.std(x))) |
| 118 | |
| 119 | |
| 120 | def mkdirs(paths): |
nothing calls this directly
no outgoing calls
no test coverage detected