Why am I getting this Futurewarning, and how do I prevent it?

I’m working on guided project #3 in the python course. It’s a project where you have to analyze a bunch of car sale listings. I keep getting the following warning message now, even though I never used to before?

My Code:

autos['price'] = (autos['price']


What I expected to happen: Nothing, actually. I don’t expect any kind of error at all.

What actually happened:

<ipython-input-8-194571f1379e>:1: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will*not* be treated as literal strings when regex=True.
  autos['price'] = (autos['price']
0    5000
1    8500
2    8990
3    4350
4    1350
Name: price, dtype: int32

I have the exact same code used again with a different column name, but I don’t get that Futurewarning message. What is causing this? So I actually tried this project a day or two ago using the same code, but did not receive this warning. The code still works, but I don’t like having that big message there.

It’s likely dependent on the Pandas version you are working with. It is possible you used a different version before.

But, the warning (not an error) is basically saying that in a future version of Pandas, when using regex, like with str.replace(), you will have to explicitly specify regex=True.

For the version of Pandas you are using, regex is True by default, but the functionality is changing in a future version (in which regex will be False by default) and the warning message is simply notifying you of that.

Oh you know now that I think about it… the first time I used that code I was doing so in the built-in Jupyter Notebook that DQ provides during the guided projects. The second time I tried I was doing it on my local machine, so that’s probably why? Do’h.