title: Filtering on a comma separated string by relative position in pandas columns
body: <p>I have a pandas dataframe that shows on a row by row basis, the packages a user has active, and whether they use that package on a trial basis using true/false logic.:</p>
  <pre><code>| User | Packages  | TrialStatus                 |
  |------|-----------|-----------------------------|
  | 345  | A,B,C,D,F | False,False,False,True,True |
  | 238  | B,C,F     | True,False,False            |
  | 467  | A,B       | False,True                  |
  </code></pre>
  <p>As you can see, the values for columns <code>packages</code> and <code>TrialStatus</code> are simply comma seperated strings. The position of the true/false values in <code>TrialStatus</code> correspoding to the package positions in the <code>packages</code> column.</p>
  <p>What I would like is an easy way to search the <code>packages</code> column for a specific package (e.g. <code>B</code>), look in the <code>TrialStatus</code> column for the trial status of package <code>B</code> and see if it's True based upon the position, and then return the original dataframe with a new column with the trial status of package B only. This should return:</p>
  <pre><code>| User | Packages  | TrialStatus                 | PackageB_TrialStatus |
  |------|-----------|-----------------------------|----------------------|
  | 345  | A,B,C,D,F | False,False,False,True,True | False                |
  | 238  | B,C,F     | True,False,False            | True                 |
  | 467  | A,B       | False,True                  | True                 |
  </code></pre>
  <p>My first thought is to combine the usual list comprehension way to create pandas conditional columns:</p>
  <p><code> df['cond_column'] = ['true' if x == 'true_value' else 'false' for x in df['other_column']]</code></p>
  <p>and combine this with some regex perhaps for the positional aspect but not sure if this would work. Can anybody please help? let me know if more explanation is needed</p>