原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/12253468.html

 

pandas.DataFrame.apply

apply 函数是 pandas 中自由度非常高的函数,使用频率也非常高。

pandas DataFrame apply

e.g.

对 name 列的数值都进行大写转化

pandas DataFrame apply

 

定义 double_df 函数是将原来的数值 *2 进行返回

pandas DataFrame apply

 

新增两列,其中’new1’列是“语文”和“英语”成绩之和的 m 倍,'new2’列是“语文”和“英语”成绩之和的 n 倍

pandas DataFrame apply

 

Reference

Python for Data Analysis Second Edition

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html

相关文章:

  • 2021-07-11
  • 2021-06-14
  • 2021-09-13
  • 2021-04-16
  • 2022-01-20
  • 2021-08-12
  • 2022-01-22
猜你喜欢
  • 2021-06-22
  • 2021-09-11
  • 2022-12-23
  • 2021-11-04
  • 2021-09-04
  • 2022-12-23
相关资源
相似解决方案