How do I modify a coumn value in Pandas where new values are two times the previous values?
I tried this:
employees.loc['salary'] = employees['salary']*2
Input: DataFrame employees
+---------+--------+
| name | salary |
+---------+--------+
| Jack | 19666 |
| Piper | 74754 |
| Mia | 62509 |
| Ulysses | 54866 |
Output:
| name | salary |
+---------+--------+
| Jack | 39332 |
| Piper | 149508 |
| Mia | 125018 |
| Ulysses | 109732 |
employees['salary'] = employees['salary']*2employees.loc['salary']will create a new row with the indexsalary. You could useemployees.loc[:, 'salary'] = ...but there is no point as already commented - just remove the.loc