lilianweng / stock-rnn

Predict stock market prices using RNN model with multilayer LSTM cells + optional multi-stock embeddings.
https://lilianweng.github.io/lil-log
1.75k stars 659 forks source link

AttributeError: 'DataFrame' object has no attribute 'sort' #32

Open gms2009 opened 5 years ago

gms2009 commented 5 years ago

python main.py got error Traceback (most recent call last): File "main.py", line 111, in tf.app.run() File "/home/xxx/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "main.py", line 100, in main target_symbol=FLAGS.stock_symbol, File "main.py", line 58, in load_sp500 info = info.sort('market_cap', ascending=False).reset_index(drop=True) File "/home/weilo/.local/lib/python2.7/site-packages/pandas/core/generic.py", line 5067, in getattr return object.getattribute(self, name) AttributeError: 'DataFrame' object has no attribute 'sort'

seems sort has been replaceed by sort_values, but not sure how to change to make it work

rejdivan commented 5 years ago

Change this line: info = info.sort('market_cap', ascending=False).reset_index(drop=True) to this: info = info.sort_values(by='market_cap', ascending=False).reset_index(drop=True)

Then, it should work.