Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the index of all NA in a dataframe column?

I have a dataframe and in a particular column I want to find the index of all NA values. How can I do it?

like image 280
Geekuna Matata Avatar asked Apr 14 '14 21:04

Geekuna Matata


People also ask

How do you find the index of a column in a data frame?

You can get the column index from the column name in Pandas using DataFrame. columns. get_loc() method.

How do I find missing values in a column in Python?

Extract rows/columns with missing values in specific columns/rows. You can use the isnull() or isna() method of pandas. DataFrame and Series to check if each element is a missing value or not. isnull() is an alias for isna() , whose usage is the same.


1 Answers

which(is.na(my.df$col.I.care.about))
like image 59
BrodieG Avatar answered Oct 21 '22 02:10

BrodieG