title: Pandas - Reading empty set from CSV using literal_eval
body: <p>I have saved a Pandas data frame to a CSV file and in the process data type information was lost and set and lists were converted to strings.</p>
  
  <p>Here is my csv file.</p>
  
  <pre><code>|id|words|tags
  0|A|{'-', 'Drawings', 'Jude'}|[]
  1|B|{'mafalda'}|[]
  2|C|set()|[]
  3|D|{'Sidestepping', 'flood'}|['mountain']
  4|E|{'visvim','jack'}|[]
  5|F|set()|[]
  6|-G|&lt;class 'object'&gt;|&lt;class 'object'&gt;
  </code></pre>
  
  <p>I am able to read this csv file <strong>if I remove index numbers 2,5, and 6</strong> which contains empty sets represented as set() and null objects. I am using the following code for this.</p>
  
  <pre><code>from ast import literal_eval
  
  df = pd.read_csv('testdata.csv', sep='|' )
  df['words'] = df['words'].apply(literal_eval)
  df['tags'] = df['tags'].apply(literal_eval)
  </code></pre>
  
  <p>However when there are empty sets, I am getting exception mentioning </p>
  
  <pre><code>ValueError: malformed node or string: &lt;_ast.Call object at 0x7f44250fc250&gt;
  </code></pre>
  
  <p>How can I read the empty sets correctly?</p>
  
  <p>UPDATE :  jezrael has provided an answer to handle the empty sets. How can I handle the null objects also.</p>
  
  <p>Also why Pandas is saving a empty set as 'set()' when it is saving a null list as [] and not 'list[]'</p>
  
  <p>Update: A sample code which created the CSV with null objects.</p>
  
  <pre><code>col_names =  ['A', 'B']
  df  = pd.DataFrame(columns = col_names)
  df.loc[len(df)] = [2, 4]
  df
  
  df['C']=object
  print(df)
  print(type(df))
  df.to_csv('Sample_File', sep='|', encoding='utf-8')
  </code></pre>