so i have a file upload functionality. after uploading the excel file, then in my python code it will read the excel file
df = pd.read_excel(file_name, target_sheet)
next im gonna do this.
json = df.to_json(orient='records', date_format='iso', date_unit='s')
then im going to update / insert the data using mongodb.
MyMongoDB.db[my_collection].update(dataType, json, upsert=True)
the dataType contains the column Header of the table. when I print the dataType it will give me this
{ u`Total: u`number, u`Agent: u`string and so on..
my plan was to avoid the data types error of all field since im extracting data from excel. when I use that one line of code. it gives me this error.
TypeError: document must be an instance of dict, bson.son.SON, or other type that inherits from collections.Mapping.
any help is appreciated. thanks community.
instance of dict, bson.son.SON, .... MongoDB data is NOT JSON. It's just inserted as adictas far as python is concerned.