'interact, panel in Python

I am very new to Python. I am trying to create a panel with MC Simulation. I would like to have an input selector for trading years.

This is what I have:

@widgets.interact(options=[1, 5, 10, 15, 20, 30])
def plot_age(options):
    
    simulation_ew = MCSimulation(
                      portfolio,
                      weights=equal_weights(portfolio),
                      num_simulation=50,
                      num_trading_days=252*options)
    clear_output(wait=True)
    simulation_ew.calc_cumulative_return() 
    display(simulation_ew)  

But I don't know how to have this in a panel object.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source