| 1248 | |
| 1249 | |
| 1250 | class CombineFirst(Blockwise): |
| 1251 | _parameters = ["frame", "other"] |
| 1252 | operation = M.combine_first |
| 1253 | |
| 1254 | @functools.cached_property |
| 1255 | def _meta(self): |
| 1256 | return make_meta( |
| 1257 | self.operation( |
| 1258 | meta_nonempty(self.frame._meta), |
| 1259 | meta_nonempty(self.other._meta), |
| 1260 | ), |
| 1261 | ) |
| 1262 | |
| 1263 | def _simplify_up(self, parent, dependents): |
| 1264 | if isinstance(parent, Projection): |
| 1265 | columns = determine_column_projection(self, parent, dependents) |
| 1266 | frame_columns = [col for col in self.frame.columns if col in columns] |
| 1267 | other_columns = [col for col in self.other.columns if col in columns] |
| 1268 | if ( |
| 1269 | self.frame.columns == frame_columns |
| 1270 | and self.other.columns == other_columns |
| 1271 | ): |
| 1272 | return |
| 1273 | |
| 1274 | return type(parent)( |
| 1275 | type(self)(self.frame[frame_columns], self.other[other_columns]), |
| 1276 | *parent.operands[1:], |
| 1277 | ) |
| 1278 | |
| 1279 | |
| 1280 | class Sample(Blockwise): |