title: How to import data from file into class object?
body: <p>I'm new to python and learning about classes and objects.</p>
  <p>I have a file with lots of Pokemon data in csv format - example below:</p>
  <pre><code>Number,Name,Type1,Type2,HP,Attack,Defense,SpecialAtk,SpecialDef,Speed,Generation,Legendary,Mega
  1,Bulbasaur,Grass,Poison,45,49,49,65,65,45,1,FALSE,FALSE
  2,Ivysaur,Grass,Poison,60,62,63,80,80,60,1,FALSE,FALSE
  3,Venusaur,Grass,Poison,80,82,83,100,100,80,1,FALSE,FALSE
  6,Mega Charizard Y,Fire,Flying,78,104,78,159,115,100,1,FALSE,TRUE
  10,Caterpie,Bug,,45,30,35,20,20,45,1,FALSE,FALSE
  11,Metapod,Bug,,50,20,55,25,25,30,1,FALSE,FALSE
  12,Butterfree,Bug,Flying,60,45,50,90,80,70,1,FALSE,FALSE
  13,Weedle,Bug,Poison,40,35,30,20,20,50,1,FALSE,FALSE
  14,Kakuna,Bug,Poison,45,25,50,25,25,35,1,FALSE,FALSE
  20,Raticate,Normal,,55,81,60,50,70,97,1,FALSE,FALSE
  </code></pre>
  <p>I've defined my Pokemon class and opened the file below:</p>
  <pre><code>pokedex = open('../resource/lib/public/pokedex.csv', 'r')
  for line in pokedex:
      row = line.strip().split(&quot;,&quot;)
  
  class Pokemon:
      def __init__(self, Number, Name, Type1, Type2 = &quot;&quot; , HP, Attack, Defense,
                  SpecialAtk, SpecialDef, Speed,Generation, Legendary, Mega):
  
          self.Number = Number
          self.Name = Name
          self.Type1 = Type1
          self.Type2 = Type2
          self.HP = HP
          self.Attack = Attack
          self.Defense = Defense
          self.SpecialAtk = SpecialAtk
          self.SpecialDef = SpecialDef
          self.Speed = Speed
          self.Generation = Generation
          self.Legendary = Legendary
          self.Mega = Mega
  
      def total_stats(self):
          total = self.HP+self.Attack+self.Defense+self.SpecialAtk+self.SpecialDef+self.Speed
          return total
  </code></pre>
  <p>I want to answer a series of questions using this data such as:</p>
  <pre><code>- What Pokemon has the highest HP statistic?
  - Excluding Pokemon that are either Mega or Legendary, what Pokemon has the highest Defense statistic?
  - Among Legendary Pokemon, what is the most common type? Include both Type1 and Type2 in your count.
  -In terms of the sum of all six stats (HP, Attack, Defense, Special Attack, Special Defense, and Speed), what is the weakest Legendary Pokemon? If there is a tie, list any of the tying Pokemon.
  </code></pre>
  <p>How would I go about doing this? I am lost on how to link the data from file with the pokemon class. Please help!</p>