def unintegrate_levels(x, d):
 x = x[:d]
 return np.asarray([np.diff(x, (d - i))[0] for i in range(d, 0, (-1))])

def unintegrate_levels ( x , d ) : x = x [ : d ] return np . asarray ( [ np . diff ( x , ( d - i ) ) [ 0 ] for i in range ( d , 0 , ( - 1 ) ) ] )
returns the successive differences needed to unintegrate the series .