title: Concat columns of a groupby object Pandas
body: <p>I have a dataset as shown below</p>
  <pre><code>           No Manufacturer  Description  Capacity Bezeichung2 Name  Year
  0   735.00.26       Yamaha           IT       125           H  NaN  1981
  1   735.00.26       Yamaha           RT       180         NaN  NaN  1990
  2   735.00.26       Yamaha           RT       180         NaN  NaN  1991
  3   735.00.26       Yamaha           RT       180         NaN  NaN  1992
  4   735.00.26       Yamaha           RT       180         NaN  NaN  1993
  5   735.01.94       Ducati  Hypermotard      1100           S  NaN  2009
  6   735.01.94       Ducati  Multistrada       950           X  ABS  2017
  7   735.01.94       Ducati  Multistrada       950           X  ABS  2018
  8   735.01.94       Ducati  Multistrada      1200           X  ABS  2017
  9   735.01.94       Ducati  Multistrada      1200           X  ABS  2015
  10  735.01.94       Ducati  Multistrada      1200           X  ABS  2016
  11  735.01.94       Ducati  Multistrada      1260           X  ABS  2018
  </code></pre>
  <p>The output should be:</p>
  <pre><code>735.00.26   Yamaha,1981,1981,IT 125 H | Yamaha,1990,1993,RT 180                                     
  735.01.94   Ducati,2009,2009,Hypermotard 1100 S | Ducati,2017,2018,Multistrada 950 X ABS | Ducati,2015,2017, Multistrada 1200 X ABS | Ducati,2018,2018,Multistrada 1260 X ABS   
  </code></pre>
  <p>Data shows part numbers in column A. That part is compatibile with multiple motorcycles. Each motorcycle model and year is listed in separate row. Output needs to consolidate it to part number in one column containing part number and 2nd column with compatibile motorcycles. As shown in output example.</p>
  <p>Output is done as follows. If the same motorcycle (EXACT MATCH in columns B,C,D,E,F) for the same part number from column A than we need to determine Year from and year to.<br />
  lowest and highest year number. Then that will go into output. For example first row will produce Yamaha,1990,1993,RT 180<br />
  Manufacturer,lowest year, highest year,Description+Capacity+Bezeichung2+Name<br />
  next motorcycle that fits part number from column A goes in after | in the same manner and so on until there is none left and we arrive at new part number from column A<br />
  If a motorcycle has only one line than that year becomes lowest and highest (the same number).</p>
  <p>I have managed to group by the columns and get the max and min of year, what I am struggling with is how to use concat, joins to get the output mentioned above.
  This is what I have done so far:</p>
  <pre><code>gk = df.groupby([df['No'],df['Manufacturer'],df['Description'],df['Capacity'],df['Bezeichung2'].fillna('tmp'),df['Name'].fillna('tmp')])[&quot;Year&quot;].agg([&quot;min&quot;, &quot;max&quot;]).reset_index().replace({'Name':{'tmp': np.nan},'Bezeichung2':{'tmp': np.nan}})
  gk.head(10)
  </code></pre>
  <p>It produces the results as:</p>
  <pre><code>          No Manufacturer  Description  Capacity Bezeichung2 Name   min   max
  0  735.00.26       Yamaha           IT       125           H  NaN  1981  1981
  1  735.00.26       Yamaha           RT       180         NaN  NaN  1990  1993
  2  735.01.94       Ducati  Hypermotard      1100           S  NaN  2009  2009
  3  735.01.94       Ducati  Multistrada       950           X  ABS  2017  2018
  4  735.01.94       Ducati  Multistrada      1200           X  ABS  2015  2017
  5  735.01.94       Ducati  Multistrada      1260           X  ABS  2018  2018
  </code></pre>
  <p>I just need to rearange columns and concat them.</p>