python基础操作笔记

一,pickle读写json格式文件pkl

k
Out[15]: {'k1': 2, 'k3': 4}

with open("test822.pkl","wb") as f:
    pickle.dump(k,f,)   

with open("test822.pkl","rb") as f:
    kk=pickle.load(f)

kk==k
Out[20]: True

二、docker删除image

docker rmi image_name

三、pandas一些操作

3.1 删除指定列

df.drop("is_str",axis=1)

3.2 列名重命名

df_1.rename(columns={"id": "ID"})

四、faiss使用全部GPU,参考博文

cpu_index = faiss.IndexFlatL2(d)
gpu_index = faiss.index_cpu_to_all_gpus(  # build the index
    cpu_index
)

五、安装包安装与否的检查


你可能感兴趣的:(python,python,docker,pandas,stable,diffusion,大模型)