各位好,因沒有學習過專業python,嘗試著自己寫出股價篩選後使用line notify即時回傳至手機,目前已分別寫出(A)用pandas篩選excel中的股票和(B)line notify的程式碼,
但想將(A)篩選出的資料用(B)傳至LINE,但不知道怎麼將兩程式碼結合...
import pandas as pd
data = pd.read_excel("0503.xlsm")
filter = (data['成交量'] > 2000) & (data['預估量'] >5)
print(data.loc[filter])
import requests
def lineNotifyMessage(token, msg):
headers = {
"Authorization": "Bearer " + token,
"Content-Type" : "application/x-www-form-urlencoded"
}
payload = {'message': msg }
r = requests.post("https://notify-api.line.me/api/notify", headers = headers, params = payload)
return r.status_code
if __name__ == "__main__":
token = 'token********'
message = '想把excel篩選出來的資訊傳出'
lineNotifyMessage(token, message)
上方這個data.loc[filter]
賦值到 msg 可以嗎?
message = ['想把excel篩選出來的資訊傳出']換成data.loc[filter]