Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gms2009 opened this issue Feb 21, 2019 · 1 comment
Open

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

gms2009 opened this issue Feb 21, 2019 · 1 comment

Comments

@gms2009
Copy link

gms2009 commented Feb 21, 2019

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants