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 matplotlib.pyplot as plt | |
x = [1, 3, 5, 7, 9] | |
y = [2, 4, 6, 8, 10] | |
plt.plot(x, y) | |
plt.show() |
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 matplotlib.pyplot as plt | |
x = [1, 3, 5, 7, 9] | |
y = [2, 4, 6, 8, 10] | |
plt.plot(x, y, "-o-") | |
plt.show() |
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
#建立Series | |
data = pd.Series([10, 15, 20]) | |
print(data) | |
#打印出 | |
""" | |
0 10 | |
1 15 | |
2 20 |
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
#建立Series | |
data = pd.Series([10, 15, 20]) | |
print("最大值", data.max()) | |
print("中位數", data.median()) | |
#打印出 | |
""" | |
最大值 20 |
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 | |
#建立dataframe | |
data = pd.DataFrame({ | |
"name":["Amy", "Bob", "Chole"], | |
"score":[100, 80, 69] | |
}) | |
print(data) | |
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] | |
}) | |
print("資料數量:", data.size) | |
print("資料型態(列, 欄):", data.shape) | |
print("資料索引:", data.index) |
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] | |
}) | |
#1.計算三位學生的成績平均值 | |
score = data["score"] |
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資料 |
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
from selenium import webdriver | |
driver = webdriver.Chrome() | |
driver.get("https://www.google.com/") |
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 time | |
from selenium import webdriver | |
driver = webdriver.Chrome() | |
driver.get("https://www.google.com/") | |
driver.find_element_by_name('q').send_keys('selenium')#至搜索框輸入selenium | |
time.sleep(1) | |
driver.find_element_by_class_name('tfB0Bf').find_element_by_tag_name('input').click() #點擊搜索框 | |
driver.close() |
OlderNewer