Can RNN work with just one input?
Yes, in this case train_x and train_y both have just 1 column.  RNN learns patterns in just that variable and tries to predict next instance based on the patterns.



Usually, this is just a theoretical exercise. In real world, you will have multiple features.  

Some examples :

https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/

https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/