with open(filename, ‘w’) as f: pickle.dump(save_object,f) # filename 形如 xxx.pkl
# 存储后,会自动将 save_obj 写入 .pkl后缀的文件
import pickle with open(‘filename.pkl‘, ‘r‘) as f: save_object = pickle.load(f) # 读取后的,save_object 直接为 Python对象
import csv with open(csv_file_name, ‘r‘) as csv_file: reader = csv.reader(csv_file) # but 这个csv的reader只能遍历一次, 下次用的时候需要再open文件
下面是读取fifa19数据集的player_data.csv 文件,返回的数据类型就是 panda.DataFrame:
原文:https://www.cnblogs.com/HankCui/p/11201375.html