avril
04/04/2024, 3:20 PMdf["dogs"] = [Dog("ruffles"), Dog("waffles"), Dog("doofus")]
to add col dogs
to df
.
• AFAICT df.where
only accepts Expressions
and so is not suitable for this (?)
• the pandas syntax of direct column assignment is not supported (probably for good reason, I've always found it messy/risky) 😅
• so the 'easiest' way I came up with was to a join
- this works but seems a bit overkill in terms of complexity
Am I overlooking something here or is this the recommended approach atm?jay
04/04/2024, 3:27 PMwith_column(“foo”, daft.lit(1))
Otherwise, a join would be the most canonical way of doing this right now, but if you had other ideas on how to enable this let us know!avril
04/04/2024, 3:44 PMdf["new_col"] = contents
where contents
is either a scalar (i.e. like your lit()
suggestion) or a Dask array. But with the Dask Array you'd still need to do some work to align partitions, so it's indeed not straightforward.