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

pandas FutureWarning #77

Open
gandy92 opened this issue Dec 7, 2022 · 0 comments
Open

pandas FutureWarning #77

gandy92 opened this issue Dec 7, 2022 · 0 comments

Comments

@gandy92
Copy link

gandy92 commented Dec 7, 2022

With current pandas, there is a FutureWarning triggered by line 607 in ``pykrakenapi.py:

.../venv/lib/python3.8/site-packages/pykrakenapi/pykrakenapi.py:607: FutureWarning: In a future version, `df.iloc[:, i] = newvals` will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either `df[df.columns[i]] = newvals` or, if columns are non-unique, `df.isetitem(i, newvals)`
  ohlc.loc[:, col] = ohlc[col].astype(float)

A working solution is to replace

for col in ['open', 'high', 'low', 'close', 'vwap', 'volume']:
    ohlc.loc[:, col] = ohlc[col].astype(float)

with

ohlc = ohlc.astype({name: float for name in ['open', 'high', 'low', 'close', 'vwap', 'volume']})

There are more similar lines like this that will require fixing.

gandy92 added a commit to gandy92/pykrakenapi that referenced this issue Dec 7, 2022
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

1 participant