I have a dataframe that looks like this:
k = pd.DataFrame({'A':[1,2,3,4], 'B':['a','b','c','d']})
And I want to insert into a mongoDB looking like this:
dic = {1:'a', 2:'b',3:'c',4:'d'}
How could I do it?
I have checked things like this but they do not seem to work on my df:
convert pandas dataframe to json object - pandas
Thanks in advance!