Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pt.debug utility transformers #220

Closed
cmacdonald opened this issue Sep 4, 2021 · 0 comments
Closed

pt.debug utility transformers #220

cmacdonald opened this issue Sep 4, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@cmacdonald
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I'm always frustrated when I cant figure out what the intermediate output in terms of data, or columns are, for a given transformer

Describe the solution you'd like
Utility transformers that can be inserted, namely:
pt.debug.print_rows()
pt.debug.print_columns()

Initial implementations

def print_columns(by_query=True, message=None):
    def _do_print(df):
        if message is not None:
            print(message)
        print(df.columns)
        return df
    return pt.apply.by_query(_do_print) if by_query else pt.apply.generic(_do_print) 

def print_rows(by_query=True, jupyter=True, head=2, message=None, columns=None):
    def _do_print(df):
        if message is not None:
            print(message)
        render = df if head is None else df.head(head)
        if columns is not None:
            render = render[columns]
        if jupyter:
            from IPython.display import display
            display(render)
        else:
            print(render)
        return df
    return pt.apply.by_query(_do_print) if by_query else pt.apply.generic(_do_print) 
@cmacdonald cmacdonald added the enhancement New feature or request label Sep 4, 2021
cmacdonald added a commit that referenced this issue Sep 6, 2021
* fix empty_Q()
* addresses pt.apply.new_column fails on empty dataframes #219
* fixes for version='snapshot'
* commit of debug transformer #220
@cmacdonald cmacdonald added this to the 0.7 milestone Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant