Error that I never seen in previous sections

Is my code wrong?? but I get the output and also get the error… maybe i should say warning? Never seen this before? what does it mean? Thank you!!

Screen Link:

My Code:

#extract year only and change datatype to float

What actually happened:

/dataquest/system/env/python3/lib/python3.4/site-packages/ipykernel/ FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame) but in a future version of pandas this will be changed to expand=True (return DataFrame)
/dataquest/system/env/python3/lib/python3.4/site-packages/ipykernel/ SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation:
1 Like

I have deleted my previous answer because I have realized what you got was actually warnings and not errors.

For the “SettingWithCopyWarning”, I’d recommend checking this Dataquest Blog post.

The first warning says that in the version of pandas that is used (which is obviously an old version), the default for “expand” clause is “False”. In newer versions, it’s set to “True”. I’d recommend doing the following:

dete_resignations["cease_date"] = dete_resignations["cease_date"].str.extract(pattern, expand=True)
dete_resignations["cease_date"] = dete_resignations["cease_date"].astype(float)

Thank you for explaining. I tried your code,I got error as well.

It is said that contains() got an unexpected keyword argument ‘expand’.

I did not use contains() there, I used extract(). Are you sure about that?

oh i see the problem!!! Thank you!

It works after i changed to extract!!!

I’m glad to have helped! :innocent: