r"""Remove a variable from multiple dataframes. Parameters ---------- group : alphapy.Group The input group. vname : str The variable to remove from the ``group``. Returns ------- None : None Other Parameters ---------------- Frame.frames :
(group, vname)
| 544 | # |
| 545 | |
| 546 | def vunapply(group, vname): |
| 547 | r"""Remove a variable from multiple dataframes. |
| 548 | |
| 549 | Parameters |
| 550 | ---------- |
| 551 | group : alphapy.Group |
| 552 | The input group. |
| 553 | vname : str |
| 554 | The variable to remove from the ``group``. |
| 555 | |
| 556 | Returns |
| 557 | ------- |
| 558 | None : None |
| 559 | |
| 560 | Other Parameters |
| 561 | ---------------- |
| 562 | Frame.frames : dict |
| 563 | Global dictionary of dataframes |
| 564 | |
| 565 | See Also |
| 566 | -------- |
| 567 | vapply |
| 568 | |
| 569 | """ |
| 570 | # get all frame names to apply variables |
| 571 | gnames = [item.lower() for item in group.all_members()] |
| 572 | # apply the variables to each frame |
| 573 | for g in gnames: |
| 574 | fname = frame_name(g, group.space) |
| 575 | if fname in Frame.frames: |
| 576 | f = Frame.frames[fname].df |
| 577 | logger.info("Unapplying variable %s from %s", vname, g) |
| 578 | if vname not in f.columns: |
| 579 | logger.info("Variable %s not in %s frame", vname, g) |
| 580 | else: |
| 581 | estr = "Frame.frames['%s'].df = f.df.drop('%s', axis=1)" \ |
| 582 | % (fname, vname) |
| 583 | exec(estr) |
| 584 | else: |
| 585 | logger.info("Frame not found: %s", fname) |
| 586 | |
| 587 | |
| 588 | # |
no test coverage detected