Hello, I have a question.
df.[df["IDColumn"] == "ID"]
If you enter "the corresponding ID" here, you can simply see the value accompanied by the ID.
In addition to this method,
Please define a function using the def statement and give an example of a coding sentence that expresses the value attached when entering the ID.
Def statement is still poor, so if you want to express a little different method, there will be some restrictions, so if you give me an example of coding, I think it will be helpful.
Thank you!
python def
import pand as pd
data = {'id':['admin','guest'],
'pass':['p@assword','guest'],
'name':['howoni','guest']}
df = pd.DataFrame(data)
def checkid(name):
print (df.loc[ df['id'] == name, ['id','pass','name']])
checkid('guest')
#result
# # id pass name
#1 guest guest guest
© 2024 OneMinuteCode. All rights reserved.