Hi,
Got a question related to the Charges API. I am trying to pull the parameter “items.persons_entitled” or any sub parameter of “items” for numerous registration numbers.
The following is the code I am using. This code simply takes the list of register numbers and passes them through the get_charges function and brings back the API response.
for index, row in df_api.iterrows():
company_number = row["Company Number"]
api_data = companies_house_api.get_charges(company_number)
df_api.at[index, "items.persons_entitled"] = api_data.get("items.persons_entitled")
df_api.at[index, "items"] = api_data.get("items")
print(f"Num: {row['Company Number']} | "\
f"Charges: {df_api.at[index,'items.persons_entitled']}")
Strangely, I am able to get the parameter “items” response as a list, which confirms that some of the register numbers do in fact have data for the parameter “items.persons_entitled”.
However, if I try to run just “items.persons_entitled” I get NaN.
Any idea how you access sub-parameters of “items” such as “items.persons_entitled” or “items.created_on”? Has anyone else dealt with this issue?
Thanks
Edgar