Linked Questions

Popular Questions

Select cell from Pandas Dataframe and convert to int

Asked by At

When selecting cell from Dataframe, it returns me Series value and append it to list as series. How to convert cell into single int value?

df = pd.DataFrame({"name": ['John', 'George', 'Ray'], "score": [123, 321, 112]})

x = df.loc[df['name']=='John', 'score'].reset_index(drop=True)
x.astype(int)
x

list=[]
list.append(x)
list

Return me [0 123 Name: score, dtype: int64], but need just [123]

Related Questions