Replacing values in a Pandas data frame

preview_player
Показать описание
Want to replace values in a Pandas data frame? Use the "replace" method. But did you know that "replace" can be invoked in a number of different ways, allowing you to specify multiple values — and even replace different values in different columns? In this video, I show you how to achieve just that, using a variety of different methods.

Рекомендации по теме
Комментарии
Автор

I didn't know the inplace=True is going to be replaced. Thanks for the heads up!

stronglycorrelated
Автор

Great tutorial.... short and to the point 👉 . Thank you.

curtisjackson
Автор

Awesome and clear like always! Thanks!

moose
Автор

Thanks for the video. Does this work for columns that contain strings? I'm trying to change the name of some cells for instance I have a column called 'Unit' which contains 'offense' in the first cell and then 'defense' in the cell below with numbers corresponding to both of those metrics in the column adjacent. I would like to change 'offense' to 'points_for' and 'defense' to 'points_against' however using the df.replace method does not seem to be working.

tomkmb