当从Dataframe中 Select 单元格时,它返回Series值并将其作为序列追加到列表中.如何将单元格转换为单个整数值?
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
还我[0 123 名称:Score,dtype:int64],但只需[123]