Note that there are some explanatory texts on larger screens.

plurals
  1. POExtracting Groups
    text
    copied!<p>Using Python 3.2 I was hoping to solve the below issue. My data consist of hundreds of rows (signifying a project) and 21 columns. The first of which is a unique project ID and the other 20 columns is the group of people, or person, that led the project. person_1 is always filled and if there is a name in person_3 that means 3 people are working together. If there is a name in person_18 that means 18 people are working together.</p> <p>I have an excel spreadsheet that is setup the following way:</p> <pre><code> unique ID person_1 person _2 person_3 person_4 ... person_20 12 Tom Sally Mike 16 Joe Mike 5 Joe Sally 1 Sally Mike Tom 6 Sally Tom Mike 2 Jared Joe Mike John ... Carl </code></pre> <p>I want to do a few things:</p> <p>1) Make a column that will give me a unique 'Group Name' which will be, using unique ID 1 as my example, Sally/Mike/Tom. So it will be the names separated by '/'. </p> <p>2) How can I treat, from my example, Sally/Mike/Tom the same as Sally/Tom/Mike. Meaning, I would like another column that makes the group name in alphabetical order (no matter the actual permutation), still separated by '/'. </p> <p>3) This question is similar to (2). However, I want the person listed in person_1 to matter. Meaning Joe/Tom/Mike is different from Tom/Joe/Mike but not different than Joe/Mike/Tom. So there will be another column that keeps person_1 at the start of the group name but alphabetizes person_2 through person_20 if applicable (i.e., if the project has more than 1 person on it).</p> <p>Thanks for the help and suggestions</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload