Pandas `dropna()` by column number

asked 2020-06-28 12:59:00 +0100

Cyrille gravatar image

updated 2020-06-28 13:55:13 +0100

In Pandas,

df.dropna(subset=['Name of the column']) remove all the rows of the database df according to the presence of a NaN sting in the column Name of the column. This is very nice but it will be simpler for me to do this by the number of the colomn detected by iloc. But I do not find the way in the documentation and in the question answer posted on the Net.

Could somebody help. Thanks

edit retag flag offensive close merge delete


I do not know if this is an answer to my question but in fact the colomns are known by keys (number or strings). The advantage is that if adds a new column one continues to have access to any column by the key. But if the keys are too long (my cases) it becomes boring.

Cyrille gravatar imageCyrille ( 2020-07-03 14:16:11 +0100 )edit