-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: add mapdf(), restore the default Base.map() behaviour #1049
Conversation
keep the semantic of Base.map() intact and rename the data frame-friendly version of map() into mapdf().
I wonder how this fits into the future jplyr.jl/Query.jl framework. Maybe we could wait a bit more, deprecate the current |
@nalimilan I must admit I wasn't aware of these packages until your comment. They look very exciting! ATM the workaround to apply a function returning not a data frame is to use
|
OTOH |
Ah, yes, it does make sense that |
An issue is what we should consider as "dataframe-compatible". For dicts, that's not really a problem since it doesn't make much sense to convert a non- |
Theoretically, |
Yeah, maybe. We could start raising a deprecation warning, and stop the automatic conversion) in the next major release (i.e. when porting to |
The other change in that direction could be So I will submit another PR with the proposed behavior changes when I can either close this PR or strip it down to just renaming |
See #1520. |
Currently,
DataFrames.jl
redefines howBase.map()
works if applied toGroupedDataFrame
orGroupApplied
. Instead of returning the collection of the results, it tries to convert eachf(sub_df)
intoDataFrame
and returnsGroupApplied
object.This PR restores the default
map()
behaviour (i.e. just returning the collection of the results). It allows e.g. usingBase.map()
to convert row groups into non-data frame objects.The older version of
map(f, ::GroupedDataFrame)
is renamed intomapdf
(similar tostackdf
). In fact, it's rarely called from the user code, because there'sby()
.I also renamed
GroupApplied
intoTransformedGroupedDataFrame
, it should better describe what it is.TransformedGroupedDataFrame
is not exported since it's clearly an internal type.