API: Rename arg to func in Series.map for consistency #61260
Labels
API - Consistency
Internal Consistency of API/Behavior
API Design
Apply
Apply, Aggregate, Transform, Map
Milestone
The API of methods taking udf follow certain patterns that make them consistent and easier to learn and use. There are some small differences, which have been listed in #40112 and #61128.
This issue is to rename the
arg
parameter ofSeries.map
tofunc
, which is the name consistently used in almost all methods. In the case ofSeries.map
, the argument is slightly different than others, given thatarg
orfunc
can also be adict
or aSeries
, which will makemap
replace values from these mappings, instead of executing an elementwise udf.This issue is for the renaming of the parameter, making the parameter consistent with other methods such as
DataFrame.apply
can be considered in another issue. But there are some cases to consider, given that the behavior ofmap
is slightly different when providing a mapping, than when providing a function that maps. In particular,map
will useNaN
when the mapping returnsNone
, but it will useNone
when the function returnsNone
. Also, if we stop supporting dictionaries, users in general should just replace their code fromSeries.map(my_dict)
toSeries.map(my_dict.get)
. But there are some special cases, for example when the dictionary is adefaultdict
,.get
will returnNone
, while the currentmap
implementation with adefaultdict
will consider the default value.The text was updated successfully, but these errors were encountered: