title: How to apply function to only 1 column of dataframe but replicate the other column as many times
body: <p>I have a dataframe which has 2 columns: Query &amp; Category. I am applying data augmentation to the Query Column of my dataframe to make the query count as 797 under each category. I have the following code as of now, but this just makes the query as 797 for each category by repeating the rows until we reach the count of 797 under each category. What changes do I have to make to it to append augmented queries after the original ones under each category until we make 797 queries for each category:</p>
  <pre><code>df2 = pd.read_csv('original_file.csv')
  rep_val = 797
  df2 = df2.groupby('Category').apply(lambda d: pd.concat(([d]*math.ceil(rep_val/d.shape[0]))).head(rep_val)).reset_index(drop = True)
  df2.to_csv('result_file.csv, index = False')
  </code></pre>
  <p>The code I have for data augmentation is:</p>
  <pre><code>import nlpaug.augmenter.sentence as nas
  aug = nas.ContextualWordEmbsForSentenceAug(model_path = 'xlnet-base-cased')
  def run(doc):
      doc = aug.augment(doc)
      return doc
  </code></pre>
  <p>I made the function called run to do something like this:</p>
  <pre><code>df = pd.read_csv('Original_file_non797.csv')
  query_to_be_augmented = df['Query']
  query_to_be_augmented.apply(run)
  </code></pre>
  <p>But this does not achieve my final goal which is to keep the original queries and only then append the augmented queries until I have 797 under each category, and do all this while also making the category column count as 797 for each category.
  An example for better understanding:</p>
  <pre><code>Suppose I need to make query count as 5 for each category
  Sample Data Frame I have:
  
  Query            Category
  
  apple is good    fruit
  mango is bad     fruit
  hi how are you   greeting
  good morning     greeting
  hello there      greeting
  
  After applying Augmentation, the resulting dataframe must be:
  
  Query                Category
  
  apple is good        fruit
  mango is bad         fruit
  apple is great       fruit
  mango is horrible    fruit
  apple good is        fruit
  hi how are you       greeting
  good morning         greeting
  hello there          greeting
  how are you doing    greeting
  morning is good      greeting
  
  As you can see, the original data remains, and augmented data is added to it until we have a count of 5 for each category.
  </code></pre>
  <p>How do I achieve this?</p>