close

[Solved] AttributeError: ‘DataFrame’ object has no attribute ‘set_value’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error AttributeError: ‘DataFrame’ object has no attribute ‘set_value’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: ‘DataFrame’ object has no attribute ‘set_value’ Error Occurs?

Today I get the following error AttributeError: ‘DataFrame’ object has no attribute ‘set_value’ in Python.

How To Solve AttributeError: ‘DataFrame’ object has no attribute ‘set_value’ Error ?

  1. How To Solve AttributeError: 'DataFrame' object has no attribute 'set_value' Error ?

    To Solve AttributeError: 'DataFrame' object has no attribute 'set_value' Error df.set_value() is deprecated since pandas version 0.21.0 Instead use df.at

  2. AttributeError: 'DataFrame' object has no attribute 'set_value'

    To Solve AttributeError: 'DataFrame' object has no attribute 'set_value' Error df.set_value() is deprecated since pandas version 0.21.0 Instead use df.at

Solution 1

Check your pandas version.

df.set_value() is deprecated since pandas version 0.21.0

Instead use df.at

import pandas as pd

df = pd.DataFrame({"A":[1, 5, 3, 4, 2], 
                   "B":[3, 2, 4, 3, 4],  
                   "C":[2, 2, 7, 3, 4], 
                   "D":[4, 3, 6, 12, 7]}) 

df.at[2,'B']=100

   A    B  C   D
0  1    3  2   4
1  5    2  2   3
2  3  100  7   6
3  4    3  3  12
4  2    4  4   7

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment