The following program is used to convert to a list obtained from nba_api to a dataframe but unable to understand the function as to what it wants to convey or is perfroming. Can someone help me understand it.
from nba_api.stats.static import teams
import pandas as pd
nba_teams = teams.get_teams()
print(nba_teams[:5])
def one_dict(list_dict): #Creating function one_dict
#could'nt understand it further than this.
keys = list_dict[0].keys()
out_dict = {key:[] for key in keys }
for dict_ in list_dict:
for key, value in dict_.items():
out_dict[key].append(value)
return out_dict
dict_nba_team = one_dict(nba_teams)
df_team = pd.DataFrame(dict_nba_team)
print(df_team.head())