title: Iterate through database and iterate certain values pandas
body: <p>I have a dataframe that has the following columns.</p>
  
  <pre><code>╔════╦══════╦═════════╗
  ║ id ║ year ║ quarter ║
  ╠════╬══════╬═════════╣
  ║  1 ║ 2018 ║       3 ║
  ║  1 ║ 2018 ║       4 ║
  ║  2 ║ 2018 ║       1 ║
  ║  2 ║ 2018 ║       2 ║
  ║  3 ║ 2018 ║       4 ║
  ╚════╩══════╩═════════╝
  </code></pre>
  
  <p>Expected Ouput:</p>
  
  <pre><code>╔════╦══════╦═════════╗
  ║ id ║ year ║ quarter ║
  ╠════╬══════╬═════════╣
  ║  1 ║ 2018 ║       3 ║
  ║  1 ║ 2018 ║       4 ║
  ║  1 ║ 2019 ║       1 ║
  ║  2 ║ 2018 ║       1 ║
  ║  2 ║ 2018 ║       2 ║
  ║  3 ║ 2018 ║       4 ║
  ║  3 ║ 2019 ║       1 ║
  ╚════╩══════╩═════════╝
  </code></pre>
  
  <p>I want to iterate over the table and if the last quarter in each id is 4, i want to add 1 to the year and make the quarter 1. Here is the following code i tried </p>
  
  <pre><code>for index, row in df.iterrows():
     if df['quarter'] is 4:
         df['quarter'] = 1
         df['year'] = df['year'] + 1
  </code></pre>
  
  <p>Im pretty new to pandas and python so if anyone has any suggestions that would be great.</p>