2. CSV資料
1. 入學資料
2. 鳶尾花
3. 在校表現
4. 答案卡
5. 樂透
6. 通話費
7. 蛋糕
8. 台北捷運
9. 台灣好行
10. 鐵達尼號
Last updated
Last updated
#匯入日期套件
from datetime import datetime
# 將字串轉成日期格式
dt_start = datetime.strptime(start, "%Y-%m-%d %H:%M:%S")
dt_end = datetime.strptime(end, "%Y-%m-%d %H:%M:%S")
# 計算兩時間間隔的秒數
seconds = (dt_end - dt_start).total_seconds()-----------------------------------------------------------------------------------------
| 序號(0)
-----------------------------------------------------------------------------------------
| 巧克力蛋糕(1) 檸檬蛋糕(2) 賭場蛋糕(3) 歌劇蛋糕(4) 草莓蛋糕(5)
-----------------------------------------------------------------------------------------
| 松露蛋糕(6) 巧克力泡芙(7) 咖啡泡芙(8) 香草泡芙(9) 拿破崙蛋糕(10)
-----------------------------------------------------------------------------------------
| 杏仁派(11) 蘋果派(12) 蘋果撻(13) 杏仁撻(14) 漿果撻(15)
-----------------------------------------------------------------------------------------
| 黑莓撻(16) 藍莓撻(17) 巧克力撻(18) 櫻桃撻(19) 檸檬撻(20)
-----------------------------------------------------------------------------------------
| 胡桃撻(21) 巧克力奶油餅乾(22) 剛果餅乾(23) 樹莓餅乾(24) 檸檬餅乾(25)
-----------------------------------------------------------------------------------------
| 巧克力蛋白酥皮(26) 香草酥皮(27) 杏仁餅乾(28) 瓦片餅乾(29) 核桃餅乾(30)
-----------------------------------------------------------------------------------------
| 杏仁果可頌(31) 蘋果可頌(32) 杏仁可頌(33) 奶酪可頌(34) 巧克力可頌(35)
-----------------------------------------------------------------------------------------
| 杏仁丹麥麵包(36) 蘋果丹麥麵包(37) 杏仁果捲(38) 杏仁果熊爪糕(39) 藍莓丹麥麵包(40)
-----------------------------------------------------------------------------------------
| 檸檬水(41) 覆盆子檸檬水(42) 橙汁(43) 綠茶(44) 瓶裝水(45)
-----------------------------------------------------------------------------------------
| 熱咖啡(46) 巧克力咖啡(47) 香草星冰樂(48) 櫻桃蘇打(49) 義式濃縮咖啡(50)
-----------------------------------------------------------------------------------------#50項商品的價格
price=[65, 60, 55, 75, 45, 50, 55, 60, 60, 75, 55, 45, 80, 85, 70, 75, 80, 90, 100, 105, 60, 75, 80, 90, 95, 65, 70, 75, 70, 60, 65, 60, 65, 70, 75, 80, 85, 90, 95, 55, 60, 65, 70, 75, 80, 55, 55, 60, 60, 65]
import math
# 計算距離(公里)
def getDistance(latA, lonA, latB, lonB):
ra = 6378140 # 赤道半徑
rb = 6356755 # 極半徑
flatten = (ra - rb) / ra # Partial rate of the earth
# change angle to radians
radLatA = math.radians(latA)
radLonA = math.radians(lonA)
radLatB = math.radians(latB)
radLonB = math.radians(lonB)
pA = math.atan(rb / ra * math.tan(radLatA))
pB = math.atan(rb / ra * math.tan(radLatB))
x = math.acos(math.sin(pA) * math.sin(pB) + math.cos(pA) * math.cos(pB) * math.cos(radLonA - radLonB))
c1 = (math.sin(x) - x) * (math.sin(pA) + math.sin(pB)) ** 2 / math.cos(x / 2) ** 2
c2 = (math.sin(x) + x) * (math.sin(pA) - math.sin(pB)) ** 2 / math.sin(x / 2) ** 2
dr = flatten / 8 * (c1 - c2)
distance = ra * (x + dr) / 1000
return distance#passengerId(序號), survived(存活), pClass(艙等), lname(姓), fname(名), sex(性別), age(年齡), sibSp(同行兄弟姊妹夫妻), parch(同行父母小孩), ticket(票根號碼), fare(票價), cabin(船艙號碼), embarked(登船地點)
passengerId, survived, pClass, lname, fname, sex, age, sibSp, parch, ticket, fare, cabin, embarked