Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why do I receive attribute error for replacing a cells content in a python dataframe?

I tried

df3.at[294,'Initial Effective Date'].str.replace("5/26/19 and 8/2/20","8/2/20")

My dataframe(df3) has multiple columns and 300 rows of data. I have a column called initial eff date
I just want to replace a cell at row 294 as it as above. but I get an error saying
attribute error: ‘str’ object has no attribute ‘str’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try

df3.at[294,'Initial Effective Date'] = "8/2/20"

.str.replace() method is for Series and you get only one cell (String) with .at()

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading