Loading tutorials
Series.map, Series.apply, DataFrame.apply and DataFrame.map all work this way, and so do assign, loc, pipe and sort_values. This chapter gives the working model they share. The later chapters cover each 5 min readSeries.map when you pass it a function. Passing a dict or another Series, the na_action option, and the comparison with apply each get6 min readSeries.map when you pass a lookup table instead of a function. It assumes you can create a pandas Series and DataFrame, select columns, and assign new columns. It also assumes you know that a Python dict stores key-value pairs. The previous chapter covered map with a function5 min readNaN. It covers what your function receives when a value is missing, how na_action changes that for map, and how to write functions that5 min readSeries.map. This one covers Series.apply, which looks similar but gives you more control over arguments and result shape.5 min readSeries.map and Series.apply in the earlier chapters. The code uses pandas 2.1 or later, because one exa5 min readSeries.map and Series.apply and shows where DataFrame.apply and DataFrame.map fit. The aim is to let you pick the right method quickly and5 min readSeries.map and Series.apply behave on a single column. Here you will learn what DataFrame.apply hands to your function, how axis changes that, and5 min readSeries.map and Series.apply from earlier chapters. Here you learn the one DataFrame method that works 5 min readSeries.apply and DataFrame.apply call your function, and what axis=0 and axis=1 mean. It covers how the type your function returns decides the shape of the result, and how to steer that shape on purpose.5 min readSeries.map, Series.apply and DataFrame.apply in earlier chapters. Here you will learn why row-wise apply is often the slowest w5 min readSeries.apply and DataFrame.apply, and that you can write a groupby call with a single key. Pandas 2.2 or later is assumed. Where older versions behave differently, the text says so.5 min readSeries.map, Series.apply, DataFrame.apply with axis, and DataFrame.map from the earlier chapters. It also assumes pandas 2.1 or l6 min read