Jerok Giauque
Jerok Giauque

Reputation: 15

Setting (Dynamic) String Equal to Output of a Function

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

Upvotes: 0

Views: 35

Answers (1)

user17242583
user17242583

Reputation:

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)

Upvotes: 1

Related Questions