This question has wrong answer. The answer’s variable name doesn’t follow variable rules so that it will throw SyntaxError. So the answer’s variable name must concatenate with ‘_’, not ‘-’. Or second’s answer could be correct answer if the DataFrame is assign as ‘column’. Plz check it out
Yes. I believe you are correct. For the ‘Correct’ answer to actually be correct is should read:
office-supply-store['remaining-inventory'] = office-supply-store['initial-inventory'] - office-supply-store['number-sold']
No clue why they decided to use hyphens in all of the names here. Bizarre!
Would either @patrickd314, @thepitycoder or @chuckwondo care to weigh in before I report this as a bug?
I think your proposed correction is correct… The column names, e.g. number-sold
aren’t valid identifiers so you would (I think) need to use the df.[colname]
form…
office_supply_store['remaining-inventory'] = office_supply_store['initial-inventory'] - office_supply_store['number-sold']
Thanks! I guess it’s what you mean
I hope to codecademy will fix it soon
Yes it is. As you mentioned, df[columnName]
form is correct
Actually the data frame itself having hyphens in the name seems to work, but the hyphens in the column names require using the df['column-name']
syntax to reference them. Again, I don’t know why they would have used hyphens. It likely is a typo.
I see. I hope they fix it soon. Thanks!
I submitted a bug report directly to the Codecademy Team. We’ll see what happens.
This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.