- Python Machine Learning Blueprints
- Alexander Combs Michael Roman
- 122字
- 2021-07-02 13:49:38
applymap
We've looked at manipulating columns and explained how to work with rows, but suppose you'd like to perform a function across all data cells in your DataFrame. This is where applymap is the correct tool. Let's take a look at an example:

Using applymap function
Here, we called applymap on our DataFrame in order to get the log of every value (np.log() utilizes the NumPy library to return this value), if that value is of the float type. This type checking prevents returning an error or a float for the species or wide petal columns, which are string and integer values respectively. Common uses of applymap include transforming or formatting each cell based on meeting a number of conditional criteria.
推薦閱讀
- Aftershot Pro:Non-destructive photo editing and management
- 圖解西門子S7-200系列PLC入門
- 基于Proteus和Keil的C51程序設計項目教程(第2版):理論、仿真、實踐相融合
- Mastering Delphi Programming:A Complete Reference Guide
- Camtasia Studio 8:Advanced Editing and Publishing Techniques
- Arduino BLINK Blueprints
- 筆記本電腦使用、維護與故障排除從入門到精通(第5版)
- 基于網絡化教學的項目化單片機應用技術
- 計算機組成技術教程
- Learning Less.js
- 零基礎輕松學修電腦主板
- 計算機組裝與維護
- 快·易·通:2天學會電腦組裝·系統安裝·日常維護與故障排除
- 計算機組裝與維護教程
- Spring微服務實戰(第2版)