replace_strict with default values #3208
Replies: 2 comments
-
|
thanks @edenian-prince for the report yeah we should have a |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I've made this into a feature request: #3209 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to map values from a dict. I have a column of values in my dataframe, and want something like if
applesis a value in my dataframe column and it is in the dict, then return the value mapped to apples, which isred. I need a default value where if a value in my dataframe column is not in the dict, then it would assigndefault.it looks like
defaultis not in narwhals currently. is there a simple way to use replace_strict and assign default values?in polars it's pretty simple:
Here's an example with narwhals:
And I get an error like this, even though there is no default parameter:
there's gotta be a simple way to do this? i tried .with/then statements but face other issues, like it's trying to assign the whole list of values to a specific row
Beta Was this translation helpful? Give feedback.
All reactions