Какой самый быстрый способ вставить панду DataFrame в mongodb с помощью PyMongo
?
попытки
db.myCollection.insert(df.to_dict())
дал ошибку
InvalidDocument: documents must have only string keys, the key was Timestamp('2013-11-23 13:31:00', tz=None)
db.myCollection.insert(df.to_json())
дал ошибку
TypeError: 'str' object does not support item assignment
db.myCollection.insert({id: df.to_json()})
дал ошибку
InvalidDocument: documents must have only string a keys, key was <built-in function id>
Д.Ф.
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 150 entries, 2013-11-23 13:31:26 to 2013-11-23 13:24:07
Data columns (total 3 columns):
amount 150 non-null values
price 150 non-null values
tid 150 non-null values
dtypes: float64(2), int64(1)