Boa noite,
Estava fazendo o curso e, quando repliquei o conteúdo, o erro relatado pelo professor dos valores NaN não ocorreu. Fui no repositório e copiei exatamente o mesmo código que o professor fez, ainda sem o erro do NaN. Procurei a documentação atualizada (scikit-learn 1.7.1), e creio que a própria biblioteca tenha corrigido o comportamento:
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html
This estimator has native support for missing values (NaNs). During training, the tree grower learns at each split point whether samples with missing values should go to the left or right child, based on the potential gain. When predicting, samples with missing values are assigned to the left or right child consequently. If no missing values were encountered for a given feature during training, then samples with missing values are mapped to whichever child has the most samples.
Logo, a problemática relatada no vídeo já não é mais válida. A apliquei da mesma forma para seguir a aula, mas seria interessante rever o material para deixá-lo atualizado.