How set a particular cell value of DataFrame in Pandas?
Set value of a particular Cell:
import pandas as pd df = pd.DataFrame({'Age': [30, 40, 30, 40, 30, 30, 20, 25], 'Height': [120, 162, 120, 120, 120, 72, 120, 81]}, index=['Jane', 'Jane', 'Aaron', 'Penelope', 'Jaane', 'Nicky', 'Armour', 'Ponting']) print("\n--------------Before------------\n") print(df) df.iat[0, 0] = 90 df.iat[0, 1] = 91 df.iat[1, 1] = 92 df.iat[2, 1] = 93 df.iat[7, 1] = 99 print("\n--------------After------------\n") print(df)
C:\python\examples>python example57.py --------------Before------------ Age Height Jane 30 120 Jane 40 162 Aaron 30 120 Penelope 40 120 Jaane 30 120 Nicky 30 72 Armour 20 120 Ponting 25 81 --------------After------------ Age Height Jane 90 91 Jane 40 92 Aaron 30 93 Penelope 40 120 Jaane 30 120 Nicky 30 72 Armour 20 120 Ponting 25 99 C:\python\examples>
2018-10-27T15:51:14+05:30
2018-10-27T15:51:14+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution