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

Unpack list of dataframes to create multiple dataframes

We have a list of 2 dataframes & want to create separate dataframes. Currently using the following code to achieve that:

for i in range(len(listOfDf)):
    globals()[f"df_{i}"] = listOfDf[i]

However, I want to name the dataframes as "Events" & "Occurance" respectively. How can this be achieved ?

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 :

Use ordinary list unpacking:

events, occurrences = listOfDf

There’s nothing special about doing this with dataframes.

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