Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

I have a Dataframe that stores Store name and daily sales count. I am trying to insert this to Salesforce using the below Python script. I, however, get an error.

TypeError: Object of type 'int64' is not JSON serializable

Given below is the view of the dataframe:


Store A,10

Store B, 12

Store C, 5

I use the below code to insert it to Salesforce:

update_list = []

for i in range((len(store))):

    update_data = {

               'name' :    store['entity_name'].iloc[i],

                'count__c': store['count'].iloc[i] }


sf_data_cursor = sf_datapull.salesforce_login()


Get the error the last line above gets executed. Could anyone assist in fixing this. Thanks.

1 Answer

0 votes
by (32.1k points)

NumPy data types don't recognize json. You need to convert the number to a Python int before serializing the object.

'count__c': int(store['count'].iloc[i])

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories