I have a pandas DataFrame.
import pandas as pd
import numpy as np
df = pd.DataFrame(np.array([['2021-09-01', 88], ['2021-09-02', 55]]),
                   columns=['Date', 'Hours'])
I want to construct multiple JSON payloads to call an external API based on the Dataframe values. I'm currently trying to use a Python loop.
    payload = {
        "day": '2021-09-01', 
        "shopCapacity": 88 
        }
    payload = {
        "day": '2021-09-02', 
        "shopCapacity": 55
        }
Using..
for date in df['Date']:
   for hours in df['Hours']:
      payload = {"day": date, 
                 "shopCapacity": hours
                 }
      print(payload)
Gives me..
{'day': '2021-09-01', 'shopCapacity': '88'}
{'day': '2021-09-01', 'shopCapacity': '55'}
{'day': '2021-09-02', 'shopCapacity': '88'}
{'day': '2021-09-02', 'shopCapacity': '55'}
I want...
{'day': '2021-09-01', 'shopCapacity': '88'}
{'day': '2021-09-02', 'shopCapacity': '55'}
I understand the nested loop is giving me the undesired output but I can't find a way to get the values I need.. +
 
    