0

I have two Pandas dataframes:

In: df_Rq Out: EH Req SH Req SD Req 0 EH-01 HL-02 1 EH-01 HL-03 SH-02 2 EH-01 HL-03 SH-03 3 EH-01 HL-03 SH-04 4 EH-01 HL-03 SH-05 In: df_TC Out: Test Case Description 0 TC00 Default 1 TC01 Test 1 2 TC02 Test 2 

Each of the test cases support each of the requirements dataframe, so I am needing to expand each row in the df_Rq to include the test case. Something like this:

In: df_Pro Out: EH Req SH Req SD Req Test Case Description 0 EH-01 HL-02 TC00 Default 1 EH-01 HL-02 TC01 Test 1 2 EH-01 HL-02 TC02 Test 2 3 EH-01 HL-03 SH-02 TC00 Default 4 EH-01 HL-03 SH-02 TC01 Test 1 5 EH-01 HL-03 SH-02 TC02 Test 2 6 EH-01 HL-03 SH-03 TC00 Default 7 EH-01 HL-03 SH-03 TC01 Test 1 8 EH-01 HL-03 SH-03 TC02 Test 2 9 EH-01 HL-03 SH-04 TC00 Default 10 EH-01 HL-03 SH-04 TC01 Test 1 11 EH-01 HL-03 SH-04 TC02 Test 2 12 EH-01 HL-03 SH-05 TC00 Default 13 EH-01 HL-03 SH-05 TC01 Test 1 14 EH-01 HL-03 SH-05 TC02 Test 2 

I have tried various for loops, append, merge commands. How would this be done?

2
  • Use dummy key and merge. df_Rq.assign(key=1).merge(df_TC.assign(key=1), on='key').. I think this a dup. Commented Nov 9, 2017 at 17:50
  • That did it. If it's a duplicate question, please show me where. I was surprised I couldn't find it. Maybe I wasn't asking the most correct way. Commented Nov 9, 2017 at 17:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.