How to change/update cell value in Python Pandas dataframe?

+1 vote

I have the following dataframe

  Name Age
0 Mike 23
1 Eric 25
2 Donna 23
3 Will 23

And I want to change the age of Mike. How can I do this?

Apr 8, 2019 in Python by Raj
23,229 views

1 answer to this question.

+1 vote

You can use the at() method to do this

df.at[0,’Age']= 20
answered Apr 8, 2019 by Kunal
when using df.at[row_num, "Col B"] = "yes":

the at() method added a new column in my data frame instead of modifying the
Col B of my dataframe.

Was this the case for anyone else?
Hi @ken, Can you please share your data frame. The syntax of df.at() is correct but probably you aren't using it in accordance with your data frame.

Related Questions In Python

0 votes
1 answer

How to get value in Pandas dataframe using index?

You can use the iloc method to do ...READ MORE

answered Apr 8, 2019 in Python by Rohit
285 views
0 votes
1 answer

How to replace values with None in Pandas data frame in Python?

Actually in later versions of pandas this ...READ MORE

answered Aug 30, 2018 in Python by Priyaj
• 57,510 points
3,020 views
0 votes
1 answer

How to use Pandas HDF5 as a Database in Python?

HDF5 works fine for concurrent read only ...READ MORE

answered Nov 30, 2018 in Python by Nymeria
• 3,520 points

edited Dec 10, 2018 by Nymeria 158 views
0 votes
1 answer

How to change one character in a string in Python?

Python strings are immutable, you change them ...READ MORE

answered Dec 4, 2018 in Python by Nymeria
• 3,520 points
158 views
0 votes
1 answer

How to rename columns in pandas (Python)?

It is easy by just adding ".columns" ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
177 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is size includes NaN ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
808 views
0 votes
2 answers

Replacing a row in pandas data.frame

key error. I love python READ MORE

answered Feb 18, 2019 in Data Analytics by anonymous
3,227 views
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,560 points
2,070 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,520 points
10,681 views
0 votes
1 answer

How to find if a value exists in Pandas dataframe?

Try this:​ for name in df['Name']: ...READ MORE

answered Apr 8, 2019 in Python by Tina
4,156 views