Sep-14-2020, 07:09 PM
Hi, I am currently trying to do which looks like a pretty complicated program. I have one dataframe without header which looks in this way:
Parameter1, Parameter2, Att1, Att1.value, Att2, Att2.value, Att3, Att3.value, Att4, Att4.value
Parameter1, Parameter2, Att2, Att2.value, Att3, Att3.value, Null, Null, Null, Null
Parameter1, Parameter2, Att1, Att1.value, Att3, Att3.value, Att2, Att2.value, Null, Null
Parameter1, Parameter2, Att3, Att3.value, Att1, Att1.value, Null, Null Null, Null
Parameter1, Parameter2, Att2, Att2.value, Att2, Att2.value, Null, Null Null, Null
(I have specified 10 colums for this dataframe to avoid issues)
Then I have created and empty dataframe just with headers:
Colum1, Colum2, Colum3, Colum4, Colum5
I need to concatenate both dataframes in the same way:
- Parameter1 and Parameter2 are fixed and value in every row should be placed in column1 and colum2.
- As you can see, attributes are a mess and they are not always placed in the same column in the first dataframe. Plus the attributes values are placed in the next column of each attribute. So I need to index Att1.value, Att2.value and Att3.value in colums 3, 4 and 5 (I am going to call these colums Att1, Att2 and Att3).
- The Att4 and Att4.value should be ignored and do not included in the new dataframe.
I would like to post a code attempt but to be honest, I do not even know how to start this. Do you think that it is possible to do? Sorry if it looks like if I would asking for a complete program but it is not the case, i just need to know if you think that it is possible to achieve and brief explanation about how would you do this. Thanks in advance.
Parameter1, Parameter2, Att1, Att1.value, Att2, Att2.value, Att3, Att3.value, Att4, Att4.value
Parameter1, Parameter2, Att2, Att2.value, Att3, Att3.value, Null, Null, Null, Null
Parameter1, Parameter2, Att1, Att1.value, Att3, Att3.value, Att2, Att2.value, Null, Null
Parameter1, Parameter2, Att3, Att3.value, Att1, Att1.value, Null, Null Null, Null
Parameter1, Parameter2, Att2, Att2.value, Att2, Att2.value, Null, Null Null, Null
(I have specified 10 colums for this dataframe to avoid issues)
Then I have created and empty dataframe just with headers:
Colum1, Colum2, Colum3, Colum4, Colum5
I need to concatenate both dataframes in the same way:
- Parameter1 and Parameter2 are fixed and value in every row should be placed in column1 and colum2.
- As you can see, attributes are a mess and they are not always placed in the same column in the first dataframe. Plus the attributes values are placed in the next column of each attribute. So I need to index Att1.value, Att2.value and Att3.value in colums 3, 4 and 5 (I am going to call these colums Att1, Att2 and Att3).
- The Att4 and Att4.value should be ignored and do not included in the new dataframe.
I would like to post a code attempt but to be honest, I do not even know how to start this. Do you think that it is possible to do? Sorry if it looks like if I would asking for a complete program but it is not the case, i just need to know if you think that it is possible to achieve and brief explanation about how would you do this. Thanks in advance.