Does anyone meet this similar FutureWarning
? I got this when I was using Tiingo+pandas_datareader?
The warning is like:
python3.8/site-packages/pandas_datareader/tiingo.py:234: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only
return pd.concat(dfs, self._concat_axis)
I think this warning does not impact my accessing to pandas data(in my case, I fetch from tiingo api), I can get all the data I want with no problem. I just want to understand if there is any risk with my current enviroment:
my python3 - 3.8.5,
Python 3.8.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
pandas_datareader version - 0.10.0
pandas version - 1.3.2
I then tested my code with a 'futureVersion' of python: 3.9.6 (comparing with python 3.8.5). To my suprise, I no longer get any warning or error, everything works fine:
bellow are details updated
platform win32
- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
Any advice is appreciated.
I.e. if I have this function:
def do_something(x, y):
pass
Then I can either call it like this, using positional arguments:
do_something(1, 2)
Or like this, using keyword arguments:
do_something(x=1, y=2)
Or like this, using a mixture of the two (but note that you're not allowed to have a positional argument after a keyword argument):
do_something(1, y=2)
Say I have this other function:
def do_something_else(x, /, y, *, z):
pass
In this function, I've marked x
as being positional-only, because it comes before the /
. And I've marked z
as being keyword-only, because it comes after the *
. y
is a positional-or-keyword parameter, as it comes after the /
but before the *
. This means that these two attempts to call the function will fail: the first one because z
is being called as a positional argument, and the second because x
is being called as a keyword argument:
do_something_else(1, 2, 3) # will fail!
do_something_else(x=1, y=2, z=3) # will fail!
These two attempts, however, will both succeed — y
is still a positional-or-keyword parameter.
do_something_else(1, 2, z=3) # fine
do_something_else(1, y=2, z=3) # fine
The FutureWarning
message has nothing to do with the version of python you're using, but has everything to do with the version of pandas
that you're using. Pandas
is a third-party library, not a part of the python core, so the pandas
version you're using is a completely different thing to the python version you're using.
The warning is letting you know that currently, you're fine to write pd.concat(dfs, self._concat_axis)
, but that they're planning on changing the definition of the function in a future version of pandas
so that all arguments except for objs
will be keyword-only. I.e., after they make this change, pd.concat(dfs, self._concat_axis)
will raise an error, and you will have to write pd.concat(dfs, axis=self._concat_axis)
instead. They are most likely considering making this change because calling functions with keyword arguments is often clearer and more readable for other people.