8.1. Applying a Function to a Column — Computational and Inferential Thinking
We have seen many examples of creating new columns of tables by applying functions to existing columns or to other arrays. All of those functions took arrays as their arguments. But frequently we will want to convert the entries in a column by a function that doesn’t take an array as its argument. For example, it might take just one number as its argument, as in the function cut_off_at_100 defined below. The function cut_off_at_100 simply returns its argument if the argument is less than or equal to 100. But if the argument is greater than 100, it returns 100. In our earlier examples using Census data, we saw that the variable AGE had a value 100 that meant “100 years old or older”. Cutting off ages at 100 in this manner is exactly what cut_off_at_100 does. To use this function on many ages at once, we will have to be able to refer to the function itself, without actually calling it. Analogously, we might show a cake recipe to a chef and ask her to use it to bake 6 cakes. In that scena
Redirecting... Redirecting to https://inferentialthinking.com/chapters/08/1/applying-a-function-to-a-column/index.html
Explore this link on the map →related reading
- Python Reference | Data 8data8.org
- python - pandas apply function that returns multiple values to rows in pandas dataframe - Stack Overflowstackoverflow.com
- An Intuitive Guide to Linear Algebra – BetterExplainedbetterexplained.com
- Cookbookcookbook.openai.com
- Making sure you're not a bot!hal.science
- Plus 2: Luyện đọc điền và đọc hiểu chuyên sâu (2024)ngoaingu24h.vn
- CSC 151 - Transforming listseikmeier.sites.grinnell.edu
- 聚合、联接或合并数据 - Tableauhelp.tableau.com
- 9.9. 时间/日期函数和操作符postgres.cn
- Wolfram Language & System Documentation Centerreference.wolfram.com
- Reading 13: Map, Filter, Reduceweb.mit.edu
- An introduction to functional programmingcodewords.recurse.com