<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
I'm trying to create a 2-dimensional array in Scipy/Numpy where each value represents the Manhattan distance from the center. It's supposed to have the same shape as the first two dimensions of a 3-dimensional array (an image, created via scipy.misc.fromimage).
<ASSISTANT_TASK:>
Python Code:
import numpy as np
from scipy.spatial import distance
shape = (6, 6)
xs, ys = np.indices(shape)
xs = xs.reshape(shape[0] * shape[1], 1)
ys = ys.reshape(shape[0] * shape[1], 1)
X = np.hstack((xs, ys))
mid_x, mid_y = (shape[0]-1)/2.0, (shape[1]-1)/2.0
result = distance.cdist(X, np.atleast_2d([mid_x, mid_y]), 'minkowski', p=1).reshape(shape)
<END_TASK>