Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading