title: Why do I get an AttributeError when using pandas apply?
body: <p>How should I convert NaN value into categorical value based on condition. I am getting error while trying to convert Nan value.</p>
  
  <pre><code>category           gender     sub-category    title
  
  health&amp;beauty      NaN         makeup         lipbalm
  
  health&amp;beauty      women       makeup         lipstick
  
  NaN                NaN         NaN            lipgloss
  </code></pre>
  
  <p>My DataFrame looks like this. And my function to convert NaN values in gender to categorical value looks like</p>
  
  <pre><code>def impute_gender(cols):
      category=cols[0]
      sub_category=cols[2]
      gender=cols[1]
      title=cols[3]
      if title.str.contains('Lip') and gender.isnull==True:
          return 'women'
  df[['category','gender','sub_category','title']].apply(impute_gender,axis=1)
  </code></pre>
  
  <p>If I run the code I am getting error </p>
  
  <pre><code>----&gt; 7     if title.str.contains('Lip') and gender.isnull()==True:
        8         print(gender)
        9 
  
  AttributeError: ("'str' object has no attribute 'str'", 'occurred at index category')
  </code></pre>
  
  <p>Complete Dataset -<a href="https://github.com/lakshmipriya04/py-sample/blob/master/intern-training-samples.csv" rel="nofollow noreferrer">https://github.com/lakshmipriya04/py-sample</a>   </p>