Is there any way to access the first element of a Series without knowing its index?
Let's say I have the following Series:
import pandas as pd
key='MCS096'
SUBJECTS = pd.DataFrame(
{
"ID": pd.Series([146], index=[145]),
"study": pd.Series(["MCS"], index=[145]),
"center": pd.Series(["Mag"], index=[145]),
"initials": pd.Series(["MCS096"], index=[145]),
}
)
Print out SUBJECTS
:
print(SUBJECTS[SUBJECTS.initials==key]['ID'])
>>> 145 146
>>> Name: ID, dtype: int64
How can I get the value 146 here without using index 145?