You can use .loc
to access a row specified by its index.
df1 = pd.DataFrame(np.random.randn(3), index=["a", "b", "Total"])
df2 = pd.DataFrame(np.random.randn(5), index=["a", "b", "c", "d", "Total"])
print(df1.loc["index"].values[0])
print(df2.loc["index"].values[0])
尝试这个:
df.Value[df.ID=='Total']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.