如何解决如何在计划循环 (PYTHON) 后追加值?
您好,我正在以 50 秒的间隔从 Google 电子表格中读取值,并且我正在使用计划库,但是当我尝试在实施计划后附加值时,不允许这样做
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import schedule
import time
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('delivery-302112-f683f6060657.json',scope)
client = gspread.authorize(creds)
# GET Spread SHEET Values
sh = client.open('FLEET')
coordinates = []
arrive = []
unit = []
def infi():
sheet2 = sh.worksheet("LOCATION")
coordinates_1 = sheet2.col_values(5)
arrive_1 = sheet2.col_values(6)
unit_1 = sheet2.col_values(1)
coordinates.append(coordinates_1)
arrive.append(arrive_1)
unit.append(unit_1)
schedule.every(50).seconds.do(infi)
while 1:
schedule.run_pending()
time.sleep(1)
# From This Point I Can't Append Values or Use Any other lists
data_dict = {"COORDINATES": pd.Series(coordinates),"UNIT": pd.Series(unit),"ARRIVE" : pd.Series(arrive)
}
df = pd.DataFrame(data_dict,columns=["UNIT","COORDINATES","ARRIVE"])
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。