Home > Net >  Setting (Dynamic) String Equal to Output of a Function
Setting (Dynamic) String Equal to Output of a Function

Time:01-01

Is it possible to set a (dynamic) string equal to the output of a function?

Please see picture below...unfortunately, I'm not able to get it to work using the method shown here.

enter image description here

CodePudding user response:

The code is actually working, but you need to make your simulator() function return the dataframe it makes. It prints it, but it doesn't return it:

Change the code for your simulator function to this:

def simulator():
    df = pd.DataFrame(np.random.randint(0,9,size=(4, 3)), columns=list('ABC'))
    return df  # instead of print(df)
  • Related