title: Replace empty list values in Pandas DataFrame with NaN
body: <p>I know that similar questions have been asked before, but I literarily tried every possible solution listed here and none of them worked.</p>
  
  <p>I am having a dataframe which consists of dates, strings, empty values, and empty list values. It is very huge, 8 million rows. </p>
  
  <p>I want to replace all of the empty list values - so only cells that contain only [], nothing else with NaN. Nothing seems to work.</p>
  
  <p>I tried this:</p>
  
  <pre><code>df = df.apply(lambda y: np.nan if (type(y) == list and len(y) == 0) else y)
  </code></pre>
  
  <p>as advised similarly in this question <a href="https://stackoverflow.com/questions/40818924/replace-empty-list-with-nan-in-pandas-dataframe">replace empty list with NaN in pandas dataframe</a> but it doesn't change anything in my dataframe. </p>
  
  <p>Any help would be appreciated.</p>