title: Python: Iterating though dataframe columns as values in a function that prints charts
body: <p>I'm trying to iterate through numeric fields in a data frame and create two separate bar charts one for Test1 and another for Test2 scores grouped by Name. I have a for loop that I get a type error on. I have a small sample of the data below but this for loop would run for data frame larger than 25 fields. Below is my code and error:</p>
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  
  data = {'Name': ['Tom', 'Joseph', 'Krish', 'John', 'Tom', 'Joseph', 'Krish', 'John'],
                     'Test1': [20, 21, 19, 18, 30, 33, 12, 10],
                     'Test2': [78, 89, 77, 91, 95, 90, 87, 70]}
  
  df = pd.DataFrame(data)
  
  for columns in df.columns[1:]:
      data = df[(df.columns &gt; 80 )].groupby(
          df.Name, as_index = True).agg(
          {columns: &quot;sum&quot;})
      fig, (ax) = plt.subplots( figsize = (24,7))
  
      data.plot(kind = 'bar', stacked = False,
                    ax = ax)
  
  TypeError: '&gt;' not supported between instances of 'str' and 'int'
  
  </code></pre>