Last active
January 7, 2022 09:30
-
-
Save yheihei/50881544d56761c3d7028a71759a3539 to your computer and use it in GitHub Desktop.
行と列指定でデータフレームの値を取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.read_csv("sample.csv") | |
df | |
# 名前 メールアドレス | |
# 0 小久保 yheihei0126@gmail.com | |
# 1 ちゃた chataro@gmail.com | |
print(df.at[0, '名前']) | |
# 小久保 | |
# こうやって検索して出すこともできる | |
result_df = df[df['名前'] == '小久保'].iloc[0] | |
print(result_df['メールアドレス']) | |
# yheihei0126@gmail.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment