How to silent an output from Prophet?

Viewed 1289

I`m using Prophet (Time series library by Facebook) and it makes a lot of output. Something like this: Prophet output

I`m already silent some output like this:

@contextmanager
def suppress_stdout():
    with open(os.devnull, "w") as devnull:
        old_stdout = sys.stdout
        sys.stdout = devnull
        try:  
            yield
        finally:
            sys.stdout = old_stdout

But it doesn't silent all types of output, how I can silent all types?

1 Answers

I suspect you are using an IPython-like environment e.g. Jupyter notebook. Then you can use the %%capture magic command in a cell.

For example,

%%capture
output = do_some_verbose_things(args)

By default it also captures the stderr which I think the outputs you see are going there.

Related