-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Equivalent of Series.map for DataFrame #12550
Comments
|
I suppose this could be shown in a doc example and the merge docs (and maybe cross-ref |
@BrenBarn do you want to do a doc-example for this? |
I find myself doing something like this all the time, so I wrote my own function for it. In terms of functionality, it's like a (vectorized and more generic)
Similar to
Happy to submit if it helps |
I'll write up an example of this in the merging docs. |
I think there should be a way to take a DataFrame and use the values in its columns as indices into a MultiIndexed Series. Here is an example:
With this data, you should be able to do
d.map(ser)
(or whatever method name instead ofmap
) and get the same result as this:You currently cannot do this without converting the rows to tuples (
ser[d]
givesValueError: Cannot index with multidimensional key
). Converting to tuple is an awkward way to do a very natural task, which is using a tabular array of data to look up values in a tabular index (i.e., a MultiIndex).I'm creating an issue to resurrect this request from much earlier discussion here and here.
The text was updated successfully, but these errors were encountered: