I am trying to read some names from a json file that include special characters. Unfortunately when I use encoding utf-8 in json.load, it still does not read in the special characters into my pandas dataframe.
def player_matrix(player_file):
with open(player_file) as f:
data = json.load(f, encoding='utf-8')
all_players = pd.DataFrame(data)
player_dataset = pd.DataFrame(columns=['player_id','name','short name', 'nation', 'team_id' ])
for index,player in all_players.iterrows():
player_dataset.at[index,'player_id']=player['wyId']
player_dataset.at[index,'name'] = str(player['firstName'])+' '+str(player['lastName'])
player_dataset.at[index,'short name'] = player['shortName']
player_dataset.at[index,'nation'] = player['currentNationalTeamId']
player_dataset.at[index,'team_id'] = player['currentTeamId']
return player_dataset
players_df = player_matrix(playerfile)
players_df
and my output looks like this:
what can I do to read in these special characters into a jupyter notebook as opposed to the unicode representation?