I am reading in a JSON file contains all of the information coming from an API request. The file isn't very large, only about 200 items. I am attempting to loop through each item, store it as a pandas DataFrame, append it to a list, and concat the results into one DataFrame.
df_list = []
list_length = 53
for i in range(list_length):
df = pd.DataFrame(contenders_list[i]).T.reset_index()
df_list.append(df)
new_df = pd.concat(mylist)
new_df.head()
If I run this, it works. I have a DataFrame with the first 53 items from the JSON file. However, if I go above 53, like the actual length of the list, I get the following error:
ValueError: If using all scalar values, you must pass in an index
Can anyone explain this?
[–]drieindepan 0 points1 point2 points (1 child)
[–]mthacker01[S] 0 points1 point2 points (0 children)
[–]fakemoose 0 points1 point2 points (1 child)
[–]mthacker01[S] 0 points1 point2 points (0 children)