Is it worth to compromise on speed to follow PEP 8 guidelines?
A reasonable question to ask, maybe not for a single instance but if you end up with extremely performance-sensitive code. Black formats the code like this:

enc = encoder.predict(
    np.array(
        [
            data[stock][4 * i : 4 * (i + 30)]
            for i in range(lens[stock] + days - 30)
        ]
    )
)