title: Calculate Tweets Per day
body: <p>I need to write a function which calculates the number of tweets that were posted per day.</p>
  <p>Function Specifications:</p>
  <ul>
  <li>It should take a pandas dataframe as input.
  It should return a new dataframe, grouped by day, with the number of tweets for that day.</li>
  <li>The index of the new dataframe should be named Date, and the column of the new dataframe should be 'Tweets', corresponding to the date and number of tweets, respectively.</li>
  <li>The date should be formated as yyyy-mm-dd, and should be a datetime object.</li>
  </ul>
  <p>My code is :</p>
  <pre><code>
  def number_of_tweets_per_day(df):
      
      df = pd.DataFrame(twitter_df['Date','Tweets'], columns =['Date', 'Tweets'])
      
      df['Date'] = pd.to_datetime(df['Date'], format = '%Y%m%d')
      df['Tweets'] = df['Tweets'].astype(str)
      
      grouped = pd.df.groupby(['Date'],['Tweets'])
      final = pd.df.count()
      
      
      
      return final
  
  </code></pre>
  <p>However when I try to run command 'number_of_tweets_per_day(twitter_df.copy())' I get an error saying twitter_df not defined.</p>
  <p><strong>DF</strong>:
  <img src="https://i.stack.imgur.com/eiZyq.png" alt="DataFrame" /></p>
  <p><strong>Expected output</strong>:
  <img src="https://i.stack.imgur.com/zCPLP.png" alt="Expected Output" /></p>
  <p>Attached links to an image of input dataframe and image of expected output.</p>
  <p>What am I doing wrong?</p>