np_utils.to_categorical()IndexError: index -2147483648 is out of bounds for axis 1 with size 2

问题遇到的现象和发生背景
用代码块功能插入代码,请勿粘贴截图

```python
Traceback (most recent call last):
  File "D:\Desktop\coding\res_machinelearning\pythonProject\Protrain.py", line 33, in 
    x_train, y_trian, x_test, y_test = prepare_data(w2id, sentences, labels, 200)
  File "D:\Desktop\coding\res_machinelearning\pythonProject\Prodataprocess.py", line 35, in prepare_data
    return np.array(X_train), np_utils.to_categorical(y_train,num_classes=2), np.array(X_val), np_utils.to_categorical(y_val,num_classes=2)
  File "D:\Desktop\coding\res_machinelearning\pythonProject\venv\lib\site-packages\keras\utils\np_utils.py", line 73, in to_categorical
    categorical[np.arange(n), y] = 1
IndexError: index -2147483648 is out of bounds for axis 1 with size 2

###### 运行结果及报错内容 
IndexError: index -2147483648 is out of bounds for axis 1 with size 2是为何呢?