-1

I have a panel of firms, and I want to do the following. Based on some conditions, I want to create a column with labels for each firm. See an example:

enter image description here

I want for each different firmid, if RDCAP is nan for all of the year range, to be classified as an EXP or else as a CAP. The issue is, that when I try to do this, it classifies firms as EXP if for a single year they have RDCAP equal to nan.

  • [Please do not post images of code, data, error messages, etc.](https://stackoverflow.com/help/how-to-ask) Provide a MRE (see [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and [How to make good reproducible pandas examples](https://stackoverflow.com/q/20109391/14311263)) and the code you're referring to. – Timus May 13 '22 at 10:08
  • Please provide enough code so others can better understand or reproduce the problem. – Community May 13 '22 at 11:10

0 Answers0