Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Loops
#1
0


I have two dataframes:

df_id:

Output:
name id region 01 850 region 01 15062 region 02 851
df_combination:

Output:
Origin destination total region 01 region 01 1954 region 01 region 02 39
I have to perform all the possible combinations between region 01 and region 02 and divide the total between the total number of combinations.

Something like this output:

Output:
Origin_id Destination_id Total_division 850 850 488.5 850 15062 488.5 15062 850 488.5 15062 15062 488.5 850 851 19.5 15062 851 19.5
I have more than 300 regions, so I wonder if do it by python code (maybe loop) would be possible.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  alternative to nested loops for large data set JonnyEnglish 2 2,522 Feb-19-2020, 11:26 PM
Last Post: JonnyEnglish

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020