Created
March 11, 2020 09:53
-
-
Save Celia-code/24fb7bb2fa5474e6e22f892b55c4b729 to your computer and use it in GitHub Desktop.
This is for pandas
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 | |
data = pd.DataFrame({ | |
"name":["Amy", "Bob", "Chole"], | |
"score":[100, 80, 69] | |
}) | |
#取得row的Series資料 | |
print("取得第二列:", data.iloc[1], sep = "\n") | |
#取得column的Series資料 | |
print("取得name欄位:", data["name"], sep = "\n") | |
#打印出 | |
""" | |
取得第二列: | |
name Bob | |
score 80 | |
Name: 1, dtype: object | |
取得name欄位: | |
0 Amy | |
1 Bob | |
2 Chole | |
Name: name, dtype: object | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment