def _checks_and_wrangling(self, x, w):
# Manage the input data in the same fashion as mpl
if np.isscalar(x):
x = [x]
input_empty = (np.size(x) == 0)
# Massage 'x' for processing.
if input_empty:
x = np.array([[]])
else:
x = cbook._reshape_2D(x)
self.n_data_sets = len(x) # number of datasets
# We need to do to 'weights' what was done to 'x'
if w is not None:
w = cbook._reshape_2D(w)
if w is not None and len(w) != self.n_data_sets:
raise ValueError('weights should have the same shape as x')
if w is not None:
for xi, wi in zip(x, w):
if wi is not None and len(wi) != len(xi):
raise ValueError('weights should have the same shape as x')
return x, w
评论列表
文章目录