How to mapping ordinal_encode result value and original value? #1927
-
Hi I'm using it because I'm interested in vaex. How can the Int value be mapped to the existing string value after the original_encode? df = df.ordinal_encode(columns="test") The value will change int after this command, and if there is a way to know which value is the enum value, please share it. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi, For now you can do this via In the future major version of vaex (i.e. vaex 5.x) when doing such encoding you will continue to see the strings, but under the hood we will treat them as ints. You can get a preview of this feature by doing: import vaex
df = vaex.datasets.titanic()
df = df._future() # enables v5 features (preview)
df = df.ordinal_encode('home_dest') |
Beta Was this translation helpful? Give feedback.
-
Hi Thanks for fast reply. :) I tested future version ordinal_encode. So I have one more question. Do I have to use the dictionary type to use encode column('hode_dest') isin in the future version? Thanks |
Beta Was this translation helpful? Give feedback.
Hi,
For now you can do this via
df._categories
. They are sorted by the way they appear in that dictionary, starting from 0.In the future major version of vaex (i.e. vaex 5.x) when doing such encoding you will continue to see the strings, but under the hood we will treat them as ints. You can get a preview of this feature by doing: