<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def network_from_array(self, array):
 """impo Defines a network from an array. Parameters array : array 3D numpy array. """

        if len(array.shape) == 2:
            array = np.array(array, ndmin=3).transpose([1, 2, 0])
        teneto.utils.check_TemporalNetwork_input(array, 'array')
        uvals = np.unique(array)
        if len(uvals) == 2 and 1 in uvals and 0 in uvals:
            i, j, t = np.where(array == 1)
            self.network = pd.DataFrame(data={'i': i, 'j': j, 't': t})
        else:
            i, j, t = np.where(array != 0)
            w = array[array != 0]
            self.network = pd.DataFrame(
                data={'i': i, 'j': j, 't': t, 'weight': w})
        self.N = int(array.shape[0])
        self.T = int(array.shape[-1])
        self._update_network()