— layout: post title: "Notes — Read and Write Files" permalink: :title category: Data Visualization tags: [Pandas, Data Visualization] — <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head>

— layout: post title: "Notes — Read and Write Files" permalink: :title category: Data Visualization tags: [Pandas, Data Visualization] — <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head>

1 文本数据(csv,txt)

  • read_csv() : 加载带分隔符的数据,默认分隔符为逗号
  • read_table() : 加载带分割的数据,默认分隔符为制表符

1.1 Requirements

安装Pymysql包: conda install pymysql

1: from PIL import Image
2: import numpy as np
3: im=np.array(Image.open('/path/of/image'))
4: print(im.shape,im.dtype)
5: 
6: b=[255,255,255]-im  #灰度变化
7: new_im=Image.fromarray(b.astype('uint8'))
8: new_im.save('/path/of/changed/image')

2 JSON和Excel数据

3 数据库的读取和存储