摘要: import pandas as pd def get_data(): q1 = [] q2 = [] p1 = input("list 1:") p2 = input("list 2:") q1=p1.split(',') q2=p2.split(',') for i,j in zip(range 阅读全文
posted @ 2020-05-29 22:26 Hany47315 阅读(1556) 评论(0) 推荐(0)
摘要: def dollar(n): global story_money money = [] for i in range(10): if 2**(i+1) > story_money-sum(money): money.append(story_money-2**i+1) break money.ap 阅读全文
posted @ 2020-05-29 19:58 Hany47315 阅读(249) 评论(0) 推荐(0)
摘要: 将 NaN 替换成某一数值 使用 fillna dataframe.fillna(value = 'xxx',inplace=True) 删除某一个值 使用 drop dataframe.drop(10,inplace=True) 交换两行的值 if m != n: temp = np.copy(d 阅读全文
posted @ 2020-05-29 18:26 Hany47315 阅读(147) 评论(0) 推荐(0)
摘要: file = open('abc.txt','r',encoding='utf-8') file = open('abc.txt','w',encoding='utf-8') 'w' 写入模式 会清空掉文件,然后再写入 不想完全覆盖掉原文件的话,使用'a' 关键字with,with open(xxx 阅读全文
posted @ 2020-05-29 12:06 Hany47315 阅读(130) 评论(0) 推荐(0)
摘要: import random ganran = float(input("请输入感染概率")) is_person_ganran = False # 人是否感染了 person_ganran = random.randint(0,100) if person_ganran /100 < ganran: 阅读全文
posted @ 2020-05-29 10:28 Hany47315 阅读(94) 评论(0) 推荐(0)