title: How to fill the values in the list and convert it into the dataframe?
body: <p>I want to make some modifications to my previous Question:</p>
  <p><a href="https://stackoverflow.com/questions/67380875/iterating-over-conditions-from-columns-and-dataframe-to-list-conversionpandas">Iterating over conditions from columns and Dataframe to list conversion(pandas)</a></p>
  <p>The dataframe is:</p>
  <pre><code> Item   Quantity  Price     Photo1     Photo2    Photo3    Photo4
  
  A        2         30      A1.jpg      A2.jpg 
  B        4         10      B1.jpg      B2.jpg    B3.jpg    B4.jpg
  C        5         15      C1.jpg
  </code></pre>
  <p>I  tried:</p>
  <pre><code>df1 = df.reindex(['Item','Quantity','Price','Photo1','Photo2','Photo3','Photo4','I','Q','P','PH',] axis=1)
  df1['I'] = df1['I'].fillna['I']
  df1['Q'] = df1['Q'].fillna['Q']
  df1['P'] = df1['P'].fillna['P']
  df1['PH'] = df1['PH'].fillna['PH']
  vals = [['I','Item'],['Q','Quantity'],['P','Price']]
  
  photo_df = df1.filter(like='Photo')
  photo_df = photo_df.transform(lambda x: np.where(x.isnull(), x, x.name)) 
  photo_df = photo_df.fillna('')
  
  vals = [y for x in photo_df.to_numpy() 
           for y in vals[:3] + [['PH',z] for z in x[x!='']] ]
  </code></pre>
  <p>vals returns:</p>
  <pre><code>[['I', 'Item'], ['Q', 'Quantity'], ['P', 'Price'], ['PH', 'Photo1'], ['PH', 'Photo2'], 
  ['I', 'Item'], ['Q', 'Quantity'], ['P', 'Price'], ['PH', 'Photo1'], ['PH', 'Photo2'], 
  ['PH', 'Photo3'], ['PH', 'Photo4'], ['I', 'Item'], ['Q', 'Quantity'], ['P', 'Price'], ['PH', 'Photo1']]
  </code></pre>
  <p>Now I want to fill in the values from the previous data frame:</p>
  <p>I tried:</p>
  <pre><code>L = [df1.loc[:, x].set_axis(range(len(x)), axis=1) for x in vals]
  </code></pre>
  <p>This returned in the format:</p>
  <pre><code>[I,A,I,B,I,C,Q,2,Q,4,Q,5....................]
  </code></pre>
  <p>I want the L as:</p>
  <pre><code>[I,A,Q,2,P,30,PH,A1.jpg,PH,A2.jpg,I,B..............]
  </code></pre>
  <p>Expected dataframe:</p>
  <pre><code>I       A
  Q       2
  P       4
  PH      A1.jpg
  PH      A2.jpg
  I       B
  Q       4
  P       10 
  PH      B1.jpg
  PH      B2.jpg
  PH      B3.jpg
  PH      B4.jpg
  I       C
  Q       5
  P       15
  PH      C1.jpg
  </code></pre>