Difference between map, applymap and apply methods in Pandas

前端 未结 10 1896
刺人心
刺人心 2020-11-22 03:00

Can you tell me when to use these vectorization methods with basic examples?

I see that map is a Series method whereas the rest are

10条回答
  •  轮回少年
    2020-11-22 03:17

    Probably simplest explanation the difference between apply and applymap:

    apply takes the whole column as a parameter and then assign the result to this column

    applymap takes the separate cell value as a parameter and assign the result back to this cell.

    NB If apply returns the single value you will have this value instead of the column after assigning and eventually will have just a row instead of matrix.

提交回复
热议问题