Can't get rid of SettingWithCopyWarning

Hey guys, I’m working on a small project outside of DataQuest. I was inspire by this article from DataQuest’s blog and decided to analyze my Netflix account. I followed everything to the letter but for some reason I keep receiving a ‘SettingWithCopyWarning’.

You can clink the link below to see file on Jupyter
Netflix.ipynb (113.0 KB)

Any help will be appreciated

You have to save your notebook and then upload it, your localhost link can’t be seen by others’ local computer.

1 Like

Hi @nelsonlupanda, you can try applying copy() method .for example when working with a dataframe and you encounter SettingWithCopyWarning , you need to copy the given dataframe first.
have a look;

df = df.copy()

I edited the post and did what you suggested. Thanks

I tried it but it still warned me after running the code.

Hi nelsonlupanda

For cell #7, you can get rid of the warning by using the following code:
new_girl_view["Start Time"] = pd.to_datetime(new_girl_view["Start Time"], utc=True)

I tried the project with the sample dataset provided in the article and it worked for me.
So, just change the code in cell 7 and then run rest of the cells again.
Let know if it works for you.


That’s how I did it first but it gave me a warning. I tried it again, still receiving a copy warning.

In that case, if you can upload your csv file, I’ll able to reproduce the issue and see whether I can help.

1 Like