Reputation: 81
I have a store in atoti, where I would like to create buckets based on a continuous variable.
Here is the screenshot to the store:
I am trying to create buckets based on age.
One solution I could think of is to, create a new column in the original data frame and then join this to the existing store.
is there is a smarter way to create a column based on another column on the fly without going back to the original data frame?
Upvotes: 1
Views: 86
Reputation: 81
Disclaimer: I am a data scientist at atoti. Well, you can use the read_pandas to read a new data frame and join it to the existing store on the fly.
Something like this should work.
# age group buckets
age_groups_store = session.read_pandas(
pd.DataFrame(
data=[("0-30Y", i) for i in range(30)]
+ [("30Y - 40Y", i) for i in range(30, 40)]
+ [("40Y - 50Y", i) for i in range(40, 50)]
+ [("50Y+", i) for i in range(50, 200)],
columns=["age group", "age"],
),
keys=["age"],
store_name="Age Groups",
)
customer_store.join(age_groups_store)
Upvotes: 0