Feed
Loops
Messenger
Contacts
Marketplace
Games
Ad Manager
Bookmark
Discover
About Tradefoox
PostLoopsListingCampaign
Tradefooxlogo
Get App
Get App
Benachrichtigungen
Favorites
Cart
Zur Wunschliste hinzugefügt
Stack OverflowStack Overflowvor 251 W
I am doing some computing on a dataset using loops. Then, based on random event, I am going to compute some float number(This means that I don't know in advance how many floats I am going to retrieve). I want to save these numbers(results) in a some kind of a list and then save them to a dataframe column ( I want to have these results for each iteration in my loop and save them in a column so I can compare them, meaning, each iteration will produce a "list" of results that will be registred in a df column)example:for y in range(1,10): for x in range(1,100): if(x>random number and x<y): result=2*xI want to save all the results in a dataframe columns by combination x,y. For example, the results for x=1,y=2 in a column then x=2,y=2 in column ...etc and the results are not of the same size, so I guess that I'll use fillna.Now I know that I can create an empty dataframe with max index and then fill it result by result, but I think there's a better way to do it! Thanks in advance.
1