Pandas Tidbits

Reading NA as strings

Pandas read “N/A” and convert it to nan. To avoid that, use na_filter=False

df = pd.read_csv("file.txt", usecols=["colA", "colB", "colC"], na_filter=False)

Get index of NaNs

In [10]: pd.isnull(df).any(1).nonzero()[0]
Out[10]: array([3, 6])