title: Python - How to combine / concatenate / join pandas series variables ignoring the empty variable
body: <p>With the help of .loc method, I am identifying the values in a column in a Panda data frame based on values in the another column of the same data frame.</p>
  
  <p>The code snippet is given below for your reference :</p>
  
  <pre><code>var1 = output_df['Player'].loc[output_df['Team']=='India'].reset_index(drop=True)
  var2 = output_df['Player'].loc[output_df['Team']=='Australia'].reset_index(drop=True)
  var3 = output_df['Player'].loc[output_df['Team']=='Algeria'].reset_index(drop=True)
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p><strong>There may be 'n' number of teams in my data frame but I want the top players from selective teams only. That's why I manually enter the team names in the code. And I may require top performer, 2nd top performer and so on. So cannot fetch values from a column in data frame by using join statement.</strong> </p>
  
  <p>Now I would be having 3 variables of type "pandas.core.series.Series"</p>
  
  <p>I already sorted this data frame in the order of descending based on another column called "Score"</p>
  
  <p>And my requirement is to fetch the top scoring player from each team and create an output variable combining all the player names with a ','.</p>
  
  <p>I tried with the below command to get the desired output :</p>
  
  <pre><code>Final = var1[0]+','+var2[0]+','+var3[0]
  </code></pre>
  
  <p>It is producing the expected output successfully but suppose if any of the variable is empty - For example consider my data frame does not have top scoring player from Algeria, var3 will be empty. Hence when I execute the previous command, it is getting ended up with "Out of bounds" error</p>
  
  <p>Is there any way to execute the previous command or is there any similar kind of command that has to ignore the null variable but combine the remaining variables together with a separator in between ?</p>
  
  <p><strong>Update</strong> </p>
  
  <p>The logic that i get here will be used for framing sentences from words based on their POS tags (noun, adjective, verb, so on). Var1 will be used for storing Nouns arranged in descending order based on some score. Var2 will be used for storing Adjectives arranged in same order as noun and so on...</p>
  
  <p><em>Finally while framing a string / sentence I would be using these variables to concatenate. Ex: top-performing-noun + top-performing-adjective + top-performing-verb. Second sentence will be formed by 2nd-top-performing-noun + 2nd-top-performing-adjective ..... Right now I do not have code snippet for the same. It is being framed from Team-Player code.</em></p>
  
  <p>Hope this update helps to understand the question more clearly**</p>