title: Pandas - insert a dataframe to MongoDB
body: <p>I am trying to insert a dataframe into MongoDB. Each row should be one document.</p>
  
  <pre><code>from pymongo import MongoClient
  import pandas as pd
  
  client = MongoClient()
  col = client['test']['test']
  
  d = {'name': ['Braund', 'Cummings', 'Heikkinen', 'Allen'],
       'age': [22,38,26,35],
       'fare': [7.25, 71.83, 0 , 8.05],
       'survived?': [False, True, True, False]}
  
  df = pd.DataFrame(d)
  
  col.insert_many(df)
  </code></pre>
  
  <p>However, the above code returns an error: <code>ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</code></p>
  
  <p>Changing <code>col.insert_many(df)</code> to <code>col.insert_many(df.to_dict())</code> or <code>col.insert_many(df.to_json())</code> causes <code>TypeError: document must be an instance of dict, bson.son.SON, bson.raw_bson.RawBSONDocument, or a type that inherits from collections.MutableMapping
  </code></p>