ValueError: ‘object too deep for desired array’

Try this:

numpy.digitize(df.iloc[:, 0], bins)

You are trying to get the values from a whole DataFrame. That is why you get the 2D array. Each row in the array is a row of the DataFrame.

Leave a Comment