from typing import Dict, Tuple import pandas as pd def get_artist_data(df: pd.DataFrame, spotify_id: str) -> Tuple[Dict[str, str], int]: """ Function will return artist related description and relevant index value Args: df: dataframe containing artists data spotify_id: artist related id from Spotify side Returns: Dictionary Index """ index = df.index[df["SPOTIFY_ARTIST_ID"] == spotify_id].tolist()[0] artist_attribute_genre = df["C_GENRES"].iloc[index] artist_attribute_name = df["C_ARTIST_NAME"].iloc[index] artist_attribute_country = df["C_FAN_COUNTRY_CODE"].iloc[index] artist_attribute_popularity = df["C_POPULARITY"].iloc[index] artist_attribute_band_type = df["C_BAND"].iloc[index] artist_attribute_pronoun = df["C_PRONOUN"].iloc[index] artist_attribute_gender = df["C_GENDER"].iloc[index] artist_description = { "name": artist_attribute_name, "genres": artist_attribute_genre[0:75], "streaming_countries": artist_attribute_country, "is artist band": artist_attribute_band_type, "pronoun": artist_attribute_pronoun, "gender": artist_attribute_gender, "popularity": artist_attribute_popularity, } return artist_description, index