- 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.
推薦閱讀
- Deep Learning with PyTorch
- Hands-On Machine Learning with C#
- OpenGL Game Development By Example
- Machine Learning Solutions
- Spring Cloud微服務(wù)和分布式系統(tǒng)實踐
- 電腦組裝與維護(hù)即時通
- Istio實戰(zhàn)指南
- 單片機(jī)原理及應(yīng)用
- Drupal Rules How-to
- USB應(yīng)用開發(fā)寶典
- Corona SDK Mobile Game Development:Beginner's Guide
- 施耐德M241/251可編程序控制器應(yīng)用技術(shù)
- ARM接口編程
- 超炫的35個Arduino制作項目
- 微型計算機(jī)原理及應(yīng)用教程(第2版)