Skip to content

map function to array of struct #10374

Closed Answered by dschneiderch
dschneiderch asked this question in Q&A
Discussion options

You must be logged in to vote

Keep It Simple, Stupid

t.mutate(
    segment_id=_.attribute.map(
        lambda row: row["id"].concat("_", row["sv"].cast("string"))
    )
).mutate(segment_ids = _.segment_id.join(",")).select(_.user, _.segment_ids)

┃ user ┃ segment_ids ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ string │
├────────┼─────────────────────────┤
│ a │ attr1_1,attr2_2,attr3_3 │
│ b │ attr1_1 │

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@dschneiderch
Comment options

@dschneiderch
Comment options

Comment options

You must be logged in to vote
2 replies
@dschneiderch
Comment options

@dschneiderch
Comment options

Answer selected by dschneiderch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant