title: Add values to a Pandas Dataframe in order to make a ranking system with weighted averages
body: <p>I am not sure how to best describe this (I am sure there is a more proper way of describing it).</p>
  <p>I have a large dataset full of house details (eg. walls, bathrooms, bedrooms, etc.) that I need to analyze and rank based on their characteristics. I have created a ranking system with &quot;4&quot; being the best and &quot;0&quot; being the worst, for example, a house with 1 bedroom may get a &quot;0&quot; for their bedroom score but a house with a 3 bathrooms may get a &quot;4&quot; for their bathroom score.</p>
  <p>Once I assocaite the ranks to all the characteristics, I plan on creating a weighted average to see which houses are the best.</p>
  <p>How is the best way to do this? I need to do this about 20 times (for 20 characteristics) and so far this is the only way I know how to do it-- and it is quite tedious, especially if I ever need to go back and change anything.</p>
  <p>Also, would be good to better understand how the df.loc function works, I was able to do make it work but I don't quite understand it.</p>
  <pre><code>    #EXAMPLE ONE, GRADING LAND USE  
      ParcelsData.loc[ParcelsData[&quot;land_use&quot;] == 'Flum/Swim Floodway (Restrected)', 'LandUseGrade'] = 0
      ParcelsData.loc[ParcelsData[&quot;land_use&quot;] == 'Single Family Residential', 'LandUseGrade'] = 4
      ParcelsData.loc[ParcelsData[&quot;land_use&quot;] == 'Wasteland, Slivers, Gullies, Rock Outcrop', 'LandUseGrade'] = 0
      ParcelsData.loc[ParcelsData[&quot;land_use&quot;] == 'Single Family Residential - Common', 'LandUseGrade'] = 4
      ParcelsData.loc[ParcelsData[&quot;land_use&quot;] == 'Multi Family', 'LandUseGrade'] = 2
      
      #EXAMPLE TWO, STORY 
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == '1 STORY', 'StoryGrade'] = 4
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == '1.5 STORY', 'StoryGrade'] = 2
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == '2.0 STORY', 'StoryGrade'] = 3
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == '2.5 STORY', 'StoryGrade'] = 2
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == '3.0 STORY', 'StoryGrade'] = 2
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == 'RANCH W/BSMT', 'StoryGrade'] = 4
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == 'BI-LEVEL', 'StoryGrade'] = 1
      ParcelsData.loc[ParcelsData[&quot;HomeDetails_storyheight&quot;] == 'SPLIT LEVEL', 'StoryGrade'] = 1
      
       #EXAMPLE THREE, ACRES
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &lt;= .1, 'AcresGrade'] = 1
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &lt;= .2, 'AcresGrade'] = 2
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &lt;= .3, 'AcresGrade'] = 3
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &lt;= .4, 'AcresGrade'] = 7
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &lt;= .5, 'AcresGrade'] = 8
      ParcelsData.loc[ParcelsData[&quot;Acres&quot;] &gt; .5, 'AcresGrade'] = 9
  </code></pre>