In GA 2.5.2 (polymers), the exercise is to select rows based on a mmi-value of a polymer (1-6) and name the new column 'onspec' where the value is either True or False. In my attempt, I used dfm['onspec'] = (dfm[x3]['mmi']>=0.9)&(dfm[x3]['mmi']<=1.1) where [x3] stands for polymer 3. However when you do this for all polymers, an error occurs and all values are False (which is not the case). How can this be done by using .loc?
First, let me say that there are a variety of ways to solve this exercise. Regarding your code snippet, it's important to realize that the number of records on the right-hand side of the equal symbol should always be equal to the number of records on the left-hand side. That is to say, if you specifically filter for polymer type 3, you should also do that for dfm['onspec']. Otherwise, you'll overwrite that column once you repeat that line of code for any of the other types of polymers. Hope that helps :)