(self, parent, dependents)
| 1373 | return df.rename(columns=columns) |
| 1374 | |
| 1375 | def _simplify_up(self, parent, dependents): |
| 1376 | if isinstance(parent, Projection) and isinstance( |
| 1377 | self.operand("columns"), Mapping |
| 1378 | ): |
| 1379 | reverse_mapping = {val: key for key, val in self.operand("columns").items()} |
| 1380 | |
| 1381 | columns = determine_column_projection(self, parent, dependents) |
| 1382 | columns = _convert_to_list(columns) |
| 1383 | frame_columns = set(self.frame.columns) |
| 1384 | columns = [ |
| 1385 | ( |
| 1386 | reverse_mapping[col] |
| 1387 | if col in reverse_mapping and reverse_mapping[col] in frame_columns |
| 1388 | else col |
| 1389 | ) |
| 1390 | for col in columns |
| 1391 | ] |
| 1392 | columns = [col for col in self.frame.columns if col in columns] |
| 1393 | if columns == self.frame.columns: |
| 1394 | return |
| 1395 | |
| 1396 | return type(parent)( |
| 1397 | type(self)(self.frame[columns], *self.operands[1:]), |
| 1398 | *parent.operands[1:], |
| 1399 | ) |
| 1400 | |
| 1401 | |
| 1402 | class ColumnsSetter(RenameFrame): |
nothing calls this directly
no test coverage detected